pub struct Rejection { /* private fields */ }Implementations
sourceimpl Rejection
impl Rejection
sourcepub fn find_cause<T: StdError + 'static>(&self) -> Option<&T>
pub fn find_cause<T: StdError + 'static>(&self) -> Option<&T>
Searches this Rejection for a specific cause.
A Rejection will accumulate causes over a Filter chain. This method
can search through them and return the first cause of this type.
Example
use std::io;
let err = io::Error::new(
io::ErrorKind::Other,
"could be any std::error::Error"
);
let reject = warp::reject::custom(err);
if let Some(cause) = reject.find_cause::<io::Error>() {
println!("found the io::Error: {}", cause);
}sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true if this Rejection was made via warp::reject::not_found.
Example
let rejection = warp::reject::not_found();
assert!(rejection.is_not_found());sourcepub fn cause(&self) -> Option<&Cause>
pub fn cause(&self) -> Option<&Cause>
Returns an optional error cause for this rejection.
If this Rejection is actuall a combination of rejections, then the
returned cause is determined by an internal ranking system. If you’d
rather handle different causes with different priorities, use
find_cause.
Note
The return type will change from &Box<Error> to &Error in v0.2.
This method isn’t marked deprecated, however, since most people aren’t
actually using the Box part, and so a deprecation warning would just
annoy people who didn’t need to make any changes.