[][src]Macro rouille::try_or_400

macro_rules! try_or_400 {
    ($result:expr) => { ... };

This macro assumes that the current function returns a Response and takes a Result. If the expression you pass to the macro is an error, then a 400 response is returned.


use rouille::Request;
use rouille::Response;

fn handle_something(request: &Request) -> Response {
    let data = try_or_400!(post_input!(request, {
        field1: u32,
        field2: String,