common_error::ext

Trait ErrorExt

source
pub trait ErrorExt: StackError {
    // Required method
    fn as_any(&self) -> &dyn Any;

    // Provided methods
    fn status_code(&self) -> StatusCode { ... }
    fn output_msg(&self) -> String
       where Self: Sized { ... }
    fn root_cause(&self) -> Option<&dyn Error>
       where Self: Sized { ... }
}
Expand description

Extension to Error in std.

Required Methods§

source

fn as_any(&self) -> &dyn Any

Returns the error as Any so that it can be downcast to a specific implementation.

Provided Methods§

source

fn status_code(&self) -> StatusCode

Map this error to StatusCode.

source

fn output_msg(&self) -> String
where Self: Sized,

source

fn root_cause(&self) -> Option<&dyn Error>
where Self: Sized,

Find out root level error for nested error

Implementors§