Weave documentation
Rust referenceweave-swarm

weave-swarm · error

Source declarations, signatures and documentation for error.

Source: sigil/weave/network/weave-swarm/src/error.rs. SHA-256: 45e23e6f67779a47035acb1396cb1f60b578f448ba1870459c8cdc54ce3dcdcd.

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::SwarmError

Swarm errors

#[derive(Debug, Error)]
pub enum SwarmError {
    #[error("DHT error: {0}")]
    Dht(#[from] anyhow::Error),

    // Identity errors removed from core swarm
    #[error("Secret stream error: {0}")]
    SecretStream(String),

    #[error("Connection error: {0}")]
    Connection(String),

    #[error("Handshake failed: {0}")]
    HandshakeFailed(String),

    #[error("Verification failed for peer {0}: {1}")]
    VerificationFailed(PeerId, String),

    #[error("Max connections reached: {0}")]
    MaxConnectionsReached(usize),

    #[error("Max peers per topic reached: {0}")]
    MaxPeersPerTopicReached(usize),

    #[error("Topic not found: {0:?}")]
    TopicNotFound(TopicId),

    #[error("Peer not found: {0:?}")]
    PeerNotFound(PeerId),

    #[error("Already connected to peer: {0:?}")]
    AlreadyConnected(PeerId),

    #[error("Connection timeout")]
    ConnectionTimeout,

    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    #[error("Channel send error")]
    ChannelSend,

    #[error("Not implemented: {0}")]
    NotImplemented(&'static str),
}

Source line: 8.

error::StableErrorCode

Stable Protocol 1.0 error families exposed without diagnostic detail.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StableErrorCode {
    NoRoute,
    RelayUnavailable,
    DirectUpgradeFailed,
    TransportAuthenticationFailed,
    PrivateDiscoveryRejected,
    ApplicationAuthorizationDenied,
    UnsupportedCriticalFeature,
    AddressPolicyDenied,
    ResourceLimitExceeded,
    RuntimeSuspended,
    NetworkChanged,
    ProtocolDowngradeDenied,
}

Source line: 55.

error::StableErrorCode::as_str

pub const fn as_str(self) -> &'static str;

Source line: 71.

error::LocalErrorCode

Stable local-only runtime failure families. These are never wire responses.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LocalErrorCode {
    ConfigurationInvalid,
    IdentityUnavailable,
    IdentityLeaseUnavailable,
    BackendUnavailable,
    InvariantViolation,
    StaleEventRejected,
    CommandChannelClosed,
    EventChannelClosed,
    EventQueueSaturated,
    ActorTaskFailed,
    CommandIdExhausted,
    OperationIdExhausted,
}

Source line: 91.

error::LocalErrorCode::as_str

pub const fn as_str(self) -> &'static str;

Source line: 107.

error::RuntimeEventCode

Event-safe code that distinguishes Protocol 1.0 families from local failures.

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RuntimeEventCode {
    Protocol(StableErrorCode),
    Local(LocalErrorCode),
}

Source line: 127.

error::RuntimeEventCode::as_str

pub const fn as_str(self) -> &'static str;

Source line: 133.

error::RuntimeError

Errors emitted by the D1a fail-closed runtime primitive.

#[derive(Debug, Error)]
pub enum RuntimeError {
    #[error("runtime activation mismatch: {0}")]
    ActivationMismatch(&'static str),

    #[error("persisted transport identity is invalid: {0}")]
    IdentityInvalid(&'static str),

    #[error("persisted transport identity I/O failed: {0}")]
    IdentityIo(std::io::Error),

    #[error("exclusive identity-store lease is unavailable")]
    IdentityLeaseUnavailable,

    #[error("runtime resource limit exceeded: {0}")]
    ResourceLimitExceeded(&'static str),

    #[error("protocol identifier is invalid or not registered")]
    ProtocolInvalid,

    #[error("protocol identifier is already registered")]
    ProtocolDuplicate,

    #[error("canonical transport PeerId is invalid")]
    TransportPeerIdInvalid,

    #[error("peer is blocked: {0}")]
    PeerBlocked(PeerId),

    #[error("duplicate connection for peer: {0}")]
    DuplicateConnection(PeerId),

    #[error("connection registry invariant failed: {0}")]
    RegistryInvariant(&'static str),

    #[error("stale runtime event rejected: {0}")]
    StaleRuntimeEvent(&'static str),

    #[error("peer is not connected through the authoritative registry: {0}")]
    PeerNotConnected(PeerId),

    #[error("runtime command queue is full")]
    CommandQueueFull,

    #[error("runtime command channel is closed")]
    CommandChannelClosed,

    #[error("runtime command response channel is closed")]
    CommandResponseClosed,

    #[error("runtime critical-event consumer is closed")]
    EventConsumerClosed,

    #[error("runtime critical-event queue is saturated")]
    EventQueueSaturated,

    #[error("runtime actor task failed")]
    RuntimeTaskFailed,

    #[error("runtime command identifier exhausted")]
    CommandIdExhausted,

    #[error("runtime operation identifier exhausted")]
    OperationIdExhausted,

    #[error("one-swarm backend is unavailable")]
    BackendUnavailable,
}

Source line: 143.

error::RuntimeError::event_code

pub const fn event_code(&self) -> RuntimeEventCode;

Source line: 226.

error::Result

Result type alias

pub type Result<T> = std::result::Result<T, SwarmError>;

Source line: 277.

On this page