[−][src]Struct gotham::handler::HandlerError
Describes an error which occurred during handler execution, and allows the creation of a HTTP
Response
.
Implementations
impl HandlerError
[src]
pub fn with_status(self, status_code: StatusCode) -> HandlerError
[src]
Sets the HTTP status code of the response which is generated by the IntoResponse
implementation.
fn handler(state: State) -> Pin<Box<HandlerFuture>> { // It's OK if this is bogus, we just need something to convert into a `HandlerError`. let io_error = std::io::Error::last_os_error(); let handler_error = io_error .into_handler_error() .with_status(StatusCode::IM_A_TEAPOT); future::err((state, handler_error)).boxed() } let test_server = TestServer::new(|| Ok(handler)).unwrap(); let response = test_server.client().get("http://example.com/").perform().unwrap(); assert_eq!(response.status(), StatusCode::IM_A_TEAPOT);
Trait Implementations
impl Debug for HandlerError
[src]
impl Display for HandlerError
[src]
impl Error for HandlerError
[src]
fn description(&self) -> &str
[src]
fn cause(&self) -> Option<&dyn Error>
[src]
fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
fn backtrace(&self) -> Option<&Backtrace>
[src]
impl IntoResponse for HandlerError
[src]
fn into_response(self, state: &State) -> Response<Body>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for HandlerError
impl Send for HandlerError
impl !Sync for HandlerError
impl Unpin for HandlerError
impl !UnwindSafe for HandlerError
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,