Public declaration syntax from forge-rs/crates/forge-comm/src/error.rs Original source SHA-256: bac2ceeffbe163b0698d94fac0621288e25dfd402f5effeeaa2770167befd214 Function bodies and constant values are omitted. This is not the complete implementation. Source line 34 #[derive(Debug, Error)] pub enum CommError { /// Message serialization to JSON failed. /// /// This typically indicates that the message payload contains values that /// cannot be represented in JSON (e.g., NaN floats, circular references). /// /// See ANVIL Spec section 10.2 -- Agent Message Envelope. #[error("message serialization failed: {reason}")] SerializationFailed { /// A human-readable explanation of the serialization failure. reason: String, }, /// Message deserialization from JSON failed. /// /// This indicates that the received bytes do not constitute a valid /// `AgentMessage` envelope. Common causes include malformed JSON, /// missing required fields, or incompatible schema versions. /// /// See ANVIL Spec section 10.2 -- Agent Message Envelope. #[error("message deserialization failed: {reason}")] DeserializationFailed { /// A human-readable explanation of the deserialization failure. reason: String, }, /// The underlying transport mechanism failed. /// /// This covers network errors, I/O failures, and other transport-layer /// issues that prevent message delivery. /// /// See ANVIL Spec section 10.1 -- Communication Contract. #[error("transport failed: {reason}")] TransportFailed { /// A human-readable explanation of the transport failure. reason: String, }, /// The transport is not connected and cannot send or receive messages. /// /// This is returned by transports that require an active connection /// (e.g., `NoopTransport::receive`). /// /// See ANVIL Spec section 10.1 -- Communication Contract. #[error("transport is not connected")] NotConnected, /// The communication channel has been closed. /// /// This is returned when the peer endpoint of a channel-based transport /// has been dropped, making further communication impossible. /// /// See ANVIL Spec section 10.3 -- Channel Lifecycle. #[error("communication channel is closed")] ChannelClosed, /// The message signature is invalid or cannot be verified. /// /// This indicates that the Ed25519 signature on the message does not /// match the claimed sender's public key, or the signature is malformed. /// /// See ANVIL Spec section 10.4 -- Message Integrity. #[error("invalid signature from sender '{sender}'")] SignatureInvalid { /// The OAS DID of the sender whose signature failed verification. sender: String, }, /// Protocol negotiation between two agents failed. /// /// The offered protocol versions did not match any version supported /// by the receiving agent. /// /// See ANVIL Spec section 10.5 -- Protocol Negotiation. #[error("protocol negotiation failed for '{offered}': {reason}")] ProtocolNegotiationFailed { /// The protocol identifier that was offered. offered: String, /// A human-readable explanation of why negotiation failed. reason: String, }, /// The message exceeds the maximum allowed size. /// /// Transports may enforce size limits to prevent resource exhaustion. /// The message must be split or the payload reduced. /// /// See ANVIL Spec section 10.2 -- Agent Message Envelope. #[error("message size {size} bytes exceeds maximum {max_size} bytes")] MessageTooLarge { /// The actual size of the message in bytes. size: usize, /// The maximum allowed size in bytes. max_size: usize, }, /// A transport operation timed out. /// /// The operation did not complete within the specified duration. /// This may indicate network congestion, an unresponsive peer, or /// a misconfigured timeout value. /// /// See ANVIL Spec section 10.1 -- Communication Contract. #[error("transport operation timed out after {duration_ms}ms")] Timeout { /// The timeout duration in milliseconds. duration_ms: u64, }, /// Replay protection rejected the received message. /// /// The envelope's nonce was already seen within the validity window, its /// timestamp was outside the configured clock-skew tolerance, or the /// envelope was a legacy wire format and legacy acceptance is disabled. /// The wrapped [`forge_core::replay::ReplayError`] carries the specific /// reason. /// /// See ANVIL Spec section 10.4 -- Message Integrity. #[error("replay protection rejected message: {0}")] ReplayDetected(#[from] forge_core::replay::ReplayError), } Source line 157 pub type CommResult = Result;