fn error_example(req: &Request<State>) -> Result<()> {
    let fail = req.param("fail")?.parse::<bool>()?;

    if fail {
        Err(Error::bad_request("you asked for it"))
    } else {
        Ok(())
    }
}
/// A route handler that returns an Error which translates into HTTP bad request
A route handler that returns an Error which translates into HTTP bad request
A route handler that returns an Error which translates into HTTP bad request
fn error_example(req: &Request<State>) -> Result<()> {
    let fail = req.param("fail")?.parse::<bool>()?;
    if fail {
        Err(Error::bad_request("you asked for it"))
    } else {
        Ok(())
    }
}
fn error_example ( req : & Request < State > ) -> Result < ( ) > { let fail = req . param ( " " ) ? . parse :: < bool > ( ) ? ; if fail { Err ( Error :: bad_request ( " " ) ) } else { Ok ( ( ) ) } }
A route handler that returns an Error which translates into HTTP bad request
A route handler that returns an Error which translates into HTTP bad request
req
&Request<State>