UniErrorOps

Trait UniErrorOps 

Source
pub trait UniErrorOps: UniDisplay + Deref<Target = dyn Error + Send + Sync + 'static> {
    // Required methods
    fn kind_code(&self) -> i32;
    fn kind_code2(&self) -> i32;
    fn kind_value(&self) -> Cow<'static, str>;
    fn kind_context_str(&self) -> Option<Cow<'static, str>>;
    fn prev_cause<'e>(&'e self) -> Option<Cause<'e>>;
    fn chain(&self) -> Chain<'_> ;
    fn root_cause(&self) -> Option<Cause<'_>>;

    // Provided method
    fn is_simple(&self) -> bool { ... }
}
Expand description

A trait that specifies the operations that can be performed on a UniError.

Required Methods§

Source

fn kind_code(&self) -> i32

Returns the code (typically for FFI) for this specific kind

Source

fn kind_code2(&self) -> i32

Returns a 2nd code (typically for FFI) for this specific kind.

Source

fn kind_value(&self) -> Cow<'static, str>

The string value of the kind, if any. This is useful for programmatic evaluation when the type is boxed in the error chain and the type is not known

Source

fn kind_context_str(&self) -> Option<Cow<'static, str>>

Returns additional context for this specific kind, if any

Source

fn prev_cause<'e>(&'e self) -> Option<Cause<'e>>

Returns a reference to the first entry in the cause chain.

Source

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

Returns an iterator over the cause chain.

Source

fn root_cause(&self) -> Option<Cause<'_>>

Returns the root cause of this error. If None is returned then this error is the root cause.

Provided Methods§

Source

fn is_simple(&self) -> bool

Returns true if the error is a SimpleError.

Implementations§

Source§

impl dyn UniErrorOps + Send + Sync

Source

pub fn downcast_ref<K: UniKind + ?Sized>(&self) -> Option<&UniError<K>>

Attempts to downcast a DynError to a reference to a UniError<T>.

Implementors§