n0_error

Trait StackError

Source
pub trait StackError:
    Display
    + Debug
    + Send
    + Sync {
    // Required methods
    fn as_std(&self) -> &(dyn Error + Send + Sync + 'static);
    fn as_dyn(&self) -> &dyn StackError;
    fn meta(&self) -> Option<&Meta>;
    fn source(&self) -> Option<ErrorRef<'_>>;
    fn is_transparent(&self) -> bool;

    // Provided methods
    fn as_ref(&self) -> ErrorRef<'_> { ... }
    fn stack(&self) -> Chain<'_>  { ... }
    fn sources(&self) -> Chain<'_>  { ... }
    fn report(&self) -> Report<'_> { ... }
}
Expand description

Trait implemented by errors produced by this crate.

It extends std::error::Error semantics with optional error metadata, and a source method where sources may also provide metadata.

Required Methods§

Source

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Returns this error as a std error reference.

Source

fn as_dyn(&self) -> &dyn StackError

Returns this error as a dyn StackError.

Source

fn meta(&self) -> Option<&Meta>

Returns metadata captured at creation time, if available.

Source

fn source(&self) -> Option<ErrorRef<'_>>

Returns the next source in the chain, if any.

Source

fn is_transparent(&self) -> bool

Returns whether this error is transparent and should be skipped in reports.

Provided Methods§

Source

fn as_ref(&self) -> ErrorRef<'_>

Returns this error as an ErrorRef.

See ErrorRef for details.

Source

fn stack(&self) -> Chain<'_>

Returns an iterator over this error followed by its sources.

Source

fn sources(&self) -> Chain<'_>

Returns an iterator over sources of this error (skipping self).

Source

fn report(&self) -> Report<'_>

Returns a Report to output the error with configurable formatting.

Implementors§