Skip to main content

ToRecursiveError

Trait ToRecursiveError 

Source
pub trait ToRecursiveError {
    // Required method
    fn construct_recursive(self, context: &'static str) -> RecursiveError;
}
Expand description

Attach context to an error which RecursiveError knows how to wrap.

By forcing ourselves to map errors everywhere in order for question mark operators to work, we ensure that we can take the opportunity to include a little bit of manual context. Pervasively done, this means that our errors have quite a lot of contextual information about the call stack and what precisely has gone wrong.

Implementing this trait is what lets RecursiveError::context select the right variant from the error’s type alone, so most call sites never need to name a variant. It also lets generic code wrap an arbitrary module error without knowing which one it has; core-crypto-ffi relies on that.

Required Methods§

Source

fn construct_recursive(self, context: &'static str) -> RecursiveError

Construct a recursive error given the current context

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToRecursiveError for E2eIdentityError

Source§

fn construct_recursive(self, context: &'static str) -> RecursiveError

Implementors§

Source§

impl ToRecursiveError for core_crypto::Error

Source§

impl ToRecursiveError for core_crypto::transaction_context::Error

Source§

impl ToRecursiveError for core_crypto::mls::conversation::Error

Source§

impl ToRecursiveError for core_crypto::mls::credential::Error