pub struct HandlerError { /* private fields */ }Expand description
Error returned from a route handler.
See the module-level docs for the full design rationale.
Implementations§
Source§impl HandlerError
impl HandlerError
Sourcepub fn new(status: StatusCode) -> Self
pub fn new(status: StatusCode) -> Self
Create a HandlerError with the given status and no source/message.
Sourcepub fn internal(message: impl Into<String>) -> Self
pub fn internal(message: impl Into<String>) -> Self
Create a 500 Internal Server Error with a human-readable message.
Sourcepub const fn with_status(self, status: StatusCode) -> Self
pub const fn with_status(self, status: StatusCode) -> Self
Override the ICAP status emitted to the client.
Sourcepub fn with_message(self, message: impl Into<String>) -> Self
pub fn with_message(self, message: impl Into<String>) -> Self
Attach a human-readable message used as the response reason phrase.
Sourcepub fn with_source(self, source: impl Into<BoxError>) -> Self
pub fn with_source(self, source: impl Into<BoxError>) -> Self
Attach an underlying error as the source (preserved in the error chain for logging).
Sourcepub const fn status(&self) -> StatusCode
pub const fn status(&self) -> StatusCode
The status code the server will send.
Trait Implementations§
Source§impl Debug for HandlerError
impl Debug for HandlerError
Source§impl Display for HandlerError
impl Display for HandlerError
Auto Trait Implementations§
impl !RefUnwindSafe for HandlerError
impl !UnwindSafe for HandlerError
impl Freeze for HandlerError
impl Send for HandlerError
impl Sync for HandlerError
impl Unpin for HandlerError
impl UnsafeUnpin for HandlerError
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