[][src]Trait gotham::handler::IntoHandlerError

pub trait IntoHandlerError {
    fn into_handler_error(self) -> HandlerError;
}

Allows conversion into a HandlerError from an implementing type.

Futures returned from handlers can resolve to an error type with a value of (State, HandlerError).

fn my_handler(state: State) -> Box<HandlerFuture> {
    match File::open("config.toml") {
        Err(e) => Box::new(future::err((state, e.into_handler_error()))),
        Ok(_) => // Create and return a response
    }
}

Required methods

fn into_handler_error(self) -> HandlerError

Convert self into a HandlerError.

The return value will have a 500 Internal Server Error as the HTTP status code. See HandlerError::with_status for an example of changing it.

Loading content...

Implementors

impl<E> IntoHandlerError for E where
    E: Error + Send + 'static, 
[src]

Loading content...