pub struct Error { /* private fields */ }
Expand description
General purpose scrappy web error.
An scrappy web error is used to carry errors from failure
or std::error
through scrappy in a convenient way. It can be created through
converting errors with into()
.
Whenever it is created from an external object a response error is created
for it that can be used to create an http response from it this means that
if you have access to an scrappy Error
you can always get a
ResponseError
reference from it.
Implementations§
Source§impl Error
impl Error
Sourcepub fn as_response_error(&self) -> &dyn ResponseError
pub fn as_response_error(&self) -> &dyn ResponseError
Returns the reference to the underlying ResponseError
.
Sourcepub fn as_error<T: ResponseError + 'static>(&self) -> Option<&T>
pub fn as_error<T: ResponseError + 'static>(&self) -> Option<&T>
Similar to as_response_error
but downcasts.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for DispatchError
impl From<Error> for DispatchError
Source§fn from(original: Error) -> DispatchError
fn from(original: Error) -> DispatchError
Converts to this type from the input type.
Source§impl From<Error> for SendRequestError
impl From<Error> for SendRequestError
Source§fn from(original: Error) -> SendRequestError
fn from(original: Error) -> SendRequestError
Converts to this type from the input type.
Source§impl From<Infallible> for Error
impl From<Infallible> for Error
Source§fn from(_: Infallible) -> Self
fn from(_: Infallible) -> Self
Converts to this type from the input type.
Source§impl From<ResponseBuilder> for Error
Convert ResponseBuilder to a Error
impl From<ResponseBuilder> for Error
Convert ResponseBuilder to a Error
Source§fn from(res: ResponseBuilder) -> Error
fn from(res: ResponseBuilder) -> Error
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl !Send for Error
impl !Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more