pub trait ErrorMessageTracer {
// Required methods
fn new_message<E: Display>(message: &E) -> Self;
fn add_message<E: Display>(self, message: &E) -> Self;
fn as_error(&self) -> Option<&(dyn Error + 'static)>;
}
Expand description
An ErrorMessageTracer
can be used to generically trace
any error detail that implements Display
.
The error tracer may add backtrace information when the tracing
methods are called. However since the error detail is required
to only implement Display
, any existing error trace may be
lost even if the error detail implements Error
and contains
backtrace, unless the backtrace is serialized in Display
.
Required Methods§
Sourcefn new_message<E: Display>(message: &E) -> Self
fn new_message<E: Display>(message: &E) -> Self
Creates a new error trace, starting from a source error
detail that implements Display
.
Sourcefn add_message<E: Display>(self, message: &E) -> Self
fn add_message<E: Display>(self, message: &E) -> Self
Adds new error detail to an existing trace.
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.