Sigil documentation
ReferenceRust referencesigil-network

sigil-network · error

Source declarations, signatures and documentation for error.

Source: sigil/node/sigil-network/src/error.rs. SHA-256: 3822616f803d441187535a75e0f15c6a7bc26c263283b557a834b0e7cea6eef6.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

error::NetworkError

Network-layer errors for the Sigil P2P subsystem. Errors that can occur in the Sigil networking layer.

#[derive(Debug, thiserror::Error)]
pub enum NetworkError {
    /// The specified peer was not found in the registry.
    #[error("peer not found: {0}")]
    PeerNotFound(String),

    /// The specified peer has been banned and cannot communicate.
    #[error("peer banned: {0}")]
    PeerBanned(String),

    /// The peer registry has reached its maximum capacity.
    #[error("maximum peer count reached")]
    MaxPeersReached,

    /// A received message failed validation.
    #[error("invalid message: {0}")]
    InvalidMessage(String),

    /// Peer information failed validation.
    #[error("invalid peer info: {0}")]
    InvalidPeerInfo(String),

    /// Peer admission failed a Sybil or eclipse-resistance gate.
    #[error("peer admission rejected: {0}")]
    PeerAdmissionRejected(String),

    /// A peer exceeded a bounded per-peer or per-topic message rate.
    #[error("peer rate limited: {peer_id} on {topic}")]
    RateLimited {
        /// Peer ID being rate limited.
        peer_id: String,
        /// Gossip topic label.
        topic: String,
    },

    /// The remote peer is running an incompatible protocol version.
    #[error("protocol mismatch: expected {expected}, got {got}")]
    ProtocolMismatch {
        /// The version this node expects.
        expected: String,
        /// The version the remote peer advertised.
        got: String,
    },

    /// The remote peer is on a different chain.
    #[error("chain mismatch: expected {expected}, got {got}")]
    ChainMismatch {
        /// The chain ID this node expects.
        expected: String,
        /// The chain ID the remote peer advertised.
        got: String,
    },

    /// A connection attempt to a peer failed.
    #[error("connection failed: {0}")]
    ConnectionFailed(String),

    /// An operation timed out.
    #[error("operation timed out")]
    Timeout,

    /// Serialization or deserialization failure.
    #[error("serialization error: {0}")]
    Serialization(String),
}

Source line: 5.

error::NetworkResult

Convenience alias for network results.

pub type NetworkResult<T> = Result<T, NetworkError>;

Source line: 71.

error::NetworkError::is_peer_fault

Returns true if this error indicates the peer should be penalized.

pub fn is_peer_fault(&self) -> bool;

Source line: 75.

On this page