http_error_bail

Macro http_error_bail 

Source
macro_rules! http_error_bail {
    ($status_code:ident $(, source = $src:expr)? $(, reason = $($arg:tt)*)?) => { ... };
    ($status_code:ident $(, $($arg:tt)*)?) => { ... };
}
Expand description

Shorthand macro to return early with an Error.

Example:

fn foo() -> anyhow::Result<()> {
    http_error_bail!(BAD_REQUEST, "invalid payload")
}