Trait ErrorMessageTracer

Source
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§

Source

fn new_message<E: Display>(message: &E) -> Self

Creates a new error trace, starting from a source error detail that implements Display.

Source

fn add_message<E: Display>(self, message: &E) -> Self

Adds new error detail to an existing trace.

Source

fn as_error(&self) -> Option<&(dyn Error + 'static)>

If the std feature is enabled, the error tracer also provides method to optionally converts itself to a dyn 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.

Implementors§