Skip to main content

ErrorCode

Trait ErrorCode 

Source
pub trait ErrorCode: Error {
    // Required method
    fn error_code(&self) -> &'static str;
}
Expand description

A trait for errors that have a unique, stable error code.

Error codes are formatted as "TypeName::VariantName" for enum variants or "TypeName" for struct errors.

Use #[derive(ErrorCode)] from xmtp_macro to automatically implement this trait.

Required Methods§

Source

fn error_code(&self) -> &'static str

Returns the unique error code for this error.

The code is a static string in the format "TypeName::VariantName".

Implementations on Foreign Types§

Source§

impl ErrorCode for EthereumCryptoError

Source§

fn error_code(&self) -> &'static str

Source§

impl ErrorCode for IdentifierValidationError

Source§

fn error_code(&self) -> &'static str

Source§

impl ErrorCode for SignatureError

Source§

fn error_code(&self) -> &'static str

Source§

impl ErrorCode for FromHexError

Source§

fn error_code(&self) -> &'static str

Source§

impl<E: ErrorCode> ErrorCode for &E

Source§

fn error_code(&self) -> &'static str

Source§

impl<E: ErrorCode> ErrorCode for Box<E>

Source§

fn error_code(&self) -> &'static str

Implementors§