Skip to main content

CodedError

Trait CodedError 

Source
pub trait CodedError: Error {
    // Required method
    fn code(&self) -> u64;
}
Expand description

Application failure that a request is answered with.

The peer can dispatch on the code and show the message. Codes below 0x100 are the protocol’s schema::ReservedErrors, and an application assigns its own from 0x100 up.

Implementing it converts the error into schema::Error, so a handler can fail a request with ? and super::Responder::fail takes it directly.

Required Methods§

Source

fn code(&self) -> u64

Returns the code identifying the failure to the peer, 0x100 or above.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§