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

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

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.

Implementors