[−][src]Trait avocado::error::ResultExt
A trait for conveniently propagating errors up the call stack.
Required methods
fn chain<M: ErrMsg>(self, message: M) -> Result<T>
If this Result
is an Err
, then prepend the specified error
to the front of the linked list of causes.
let ok: Result<_> = Ok("success!"); let ok_chained = ok.chain("dummy error message")?; assert_eq!(ok_chained, "success!"); let err: Result<i32> = Err(Error::new( ErrorKind::MongoDbError, "chained cause" )); let err_chained = err.chain("top-level message").unwrap_err(); assert_eq!(err_chained.description(), "top-level message"); assert_eq!(err_chained.kind(), ErrorKind::MongoDbError);
Implementations on Foreign Types
impl<T, E> ResultExt<T> for Result<T, E> where
E: ErrorExt + 'static,
[src]
Loading content...
E: ErrorExt + 'static,