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§
Sourcefn error_code(&self) -> &'static str
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".