Trait error_chain::ResultExt
[−]
[src]
pub trait ResultExt<T, E, CE: ChainedError> { fn chain_err<F, EK>(self, callback: F) -> Result<T, CE> where F: FnOnce() -> EK, EK: Into<CE::ErrorKind>; }
Additionnal methods for Result
, for easy interaction with this crate.
Required Methods
fn chain_err<F, EK>(self, callback: F) -> Result<T, CE> where F: FnOnce() -> EK, EK: Into<CE::ErrorKind>
If the Result
is an Err
then chain_err
evaluates the closure,
which returns some type that can be converted to ErrorKind
, boxes
the original error to store as the cause, then returns a new error
containing the original error.
Implementors
impl<T, E, CE> ResultExt<T, E, CE> for Result<T, E> where CE: ChainedError, E: Into<CE>