Struct gotham::handler::HandlerError
[−]
[src]
pub struct HandlerError { /* fields omitted */ }
Describes an error which occurred during handler execution, and allows the creation of a HTTP
Response
.
Methods
impl HandlerError
[src]
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) -> 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::ImATeapot); Box::new(future::err((state, handler_error))) } let test_server = TestServer::new(|| Ok(handler)).unwrap(); let response = test_server.client().get("http://example.com/").perform().unwrap(); assert_eq!(response.status(), StatusCode::ImATeapot);
Trait Implementations
impl Display for HandlerError
[src]
fn fmt(&self, out: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Debug for HandlerError
[src]
impl Error for HandlerError
[src]
fn description(&self) -> &str
[src]
A short description of the error. Read more
fn cause(&self) -> Option<&Error>
[src]
The lower-level cause of this error, if any. Read more
impl IntoResponse for HandlerError
[src]
fn into_response(self, state: &State) -> Response
[src]
Converts this value into a hyper::Response