Trait http_problem::prelude::ProblemResultExt
source · [−]pub trait ProblemResultExt: ResultExt {
fn catch_err<E>(self) -> Result<Result<Self::Value, E>>
where
E: Error + Send + Sync + 'static;
fn optional(self) -> Result<Option<Self::Value>>;
}Expand description
Extension methods on Result<T, Problem>.
Required Methods
sourcefn catch_err<E>(self) -> Result<Result<Self::Value, E>>where
E: Error + Send + Sync + 'static,
fn catch_err<E>(self) -> Result<Result<Self::Value, E>>where
E: Error + Send + Sync + 'static,
Catch a specific error type E.
Returns Ok(Ok(_)) when the source Result<T> is a T, returns
Ok(Err(_)) when its is a Problem that can downcast to an E,
and returns Err(_) otherwise.
Useful when there is a need to handle a specific error differently,
e.g. a NotFound error.
Errors
Returns Err if self contains a Problem which is not an E.