#[non_exhaustive]pub enum Error {
TransportNotAvailable(String),
PeerNotReachable(String),
SendFailed(String),
ReceiveFailed(String),
ConfigurationError(String),
SerializationError(String),
Core(Error),
MessageTooLarge(usize, usize),
CryptoError(String),
Other(String),
}Expand description
Errors that can occur in the transport layer.
Display (the #[error(...)] text) is human-facing and free to change.
Error::code is the stable, machine-readable contract — downstream
telemetry classifies on the code, never on the Display wording.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TransportNotAvailable(String)
Transport is not available or supported.
PeerNotReachable(String)
Recipient is not reachable via this transport.
Unlike TransportNotAvailable, the transport itself is healthy –
only this specific peer cannot be reached through it.
SendFailed(String)
Failed to send message.
ReceiveFailed(String)
Failed to receive message.
ConfigurationError(String)
Transport configuration error.
SerializationError(String)
Serialization/deserialization error.
Core(Error)
Core error propagated from offline-protocol-core.
MessageTooLarge(usize, usize)
Message exceeds the configured maximum size.
CryptoError(String)
Cryptographic operation failed (key derivation, signing).
Other(String)
Generic error.
Implementations§
Source§impl Error
impl Error
Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
Returns a stable, non-localized machine-readable error code.
Unlike Display, this value is a contract:
downstream consumers (e.g. telemetry classifiers) switch on it instead
of substring-matching human-readable error text. Keep these strings
stable — changing one reclassifies every event that carries it.
The match is intentionally exhaustive (no wildcard arm) so that adding a new variant fails to compile until it is assigned a code.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()