pub trait AsError {
// Required methods
fn kind() -> ErrorKind;
fn message(&self) -> String;
fn class(&self) -> String;
fn details(&self) -> Option<BTreeMap<String, Value>>;
}
Expand description
Trait representing a structured error with categorized information.
The AsError
trait provides a standardized way to define and retrieve
detailed error information, including its kind, message, classification,
and additional details.
Implementing this trait allows for better error management and debugging by ensuring consistency in error structures.
Required Methods§
Sourcefn kind() -> ErrorKind
fn kind() -> ErrorKind
The kind of error.
The error kind represents a categorized type of error, allowing consumers to handle different error types distinctly.
Sourcefn message(&self) -> String
fn message(&self) -> String
The error message.
This message provides a human-readable description of the error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.