dragonfly_client_core::error::errors

Trait OrErr

Source
pub trait OrErr<T, E> {
    // Required methods
    fn or_err(self, et: ErrorType) -> Result<T, ExternalError>
       where E: Into<Box<dyn ErrorTrait + Send + Sync>>;
    fn or_context(
        self,
        et: ErrorType,
        context: &'static str,
    ) -> Result<T, ExternalError>
       where E: Into<Box<dyn ErrorTrait + Send + Sync>>;
}
Expand description

OrErr is the trait to extend the result with error.

Required Methods§

Source

fn or_err(self, et: ErrorType) -> Result<T, ExternalError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>,

Wrap the E in Result with new ErrorType and context, the existing E will be the cause.

This is a shortcut for map_err() + because()

Source

fn or_context( self, et: ErrorType, context: &'static str, ) -> Result<T, ExternalError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>,

Implementations on Foreign Types§

Source§

impl<T, E> OrErr<T, E> for Result<T, E>

OrErr implements the OrErr for Result.

Source§

fn or_err(self, et: ErrorType) -> Result<T, ExternalError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>,

Source§

fn or_context( self, et: ErrorType, context: &'static str, ) -> Result<T, ExternalError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>,

Implementors§