pub struct Error(_);
Expand description
A type which holds all kinds of errors occurring in handlers.
Implementations
sourceimpl Error
impl Error
sourcepub fn new(err: impl Into<Box<dyn HttpError>>) -> Self
pub fn new(err: impl Into<Box<dyn HttpError>>) -> Self
Creates an Error
from the specified value implementing HttpError
.
sourcepub fn critical(err: Critical) -> Self
pub fn critical(err: Critical) -> Self
Creates a critical error from an error value.
The word “critical” means that the error will not be converted into an HTTP response. If the framework receives this kind of error, it wlll abort the current connection abruptly without sending an HTTP response.
See the documentation at hyper for details.
sourcepub fn is_critical(&self) -> bool
pub fn is_critical(&self) -> bool
Returns true
if this error is a critical error.
sourcepub fn as_http_error(&self) -> Option<&dyn HttpError>
pub fn as_http_error(&self) -> Option<&dyn HttpError>
Returns the representation as HttpError
of this error value by reference.
If the value is a criticial error, it will return a None
.
sourcepub fn into_http_error(self) -> Result<Box<dyn HttpError>, Critical>
pub fn into_http_error(self) -> Result<Box<dyn HttpError>, Critical>
Deconstructs self
into inner error representation.
sourcepub fn downcast<T: HttpError>(self) -> Result<T, Self>
pub fn downcast<T: HttpError>(self) -> Result<T, Self>
Attempts to downcast this error value into the specified concrete type.
sourcepub fn downcast_ref<T: HttpError>(&self) -> Option<&T>
pub fn downcast_ref<T: HttpError>(&self) -> Option<&T>
Attempts to downcast this error value to the specified concrete type by reference.
sourcepub fn downcast_mut<T: HttpError>(&mut self) -> Option<&mut T>
pub fn downcast_mut<T: HttpError>(&mut self) -> Option<&mut T>
Attempts to downcast this error value to the specified concrete type by reference.