Macro err

Source
macro_rules! err {
    ($reason:literal) => { ... };
    ($reason:literal,) => { ... };
    ($reason:literal, $($arg:tt)+) => { ... };
    ($info:expr) => { ... };
    ($info:expr, $reason:literal) => { ... };
    ($info:expr, $reason:literal,) => { ... };
    ($info:expr, $reason:literal, $($arg:tt)+) => { ... };
}
Expand description

Creates a new Box<Error>, which will be unexpected if the provided info has a server error status.

ยงExamples

// We can provide a reason
err!("This is the reason for an unexpected internal server error");
err!("This is also, with formatted text: {}", id);
// Or some ErrorInfo
err!(GenericErrorCode::BadRequest);
err!(GenericErrorCode::Forbidden, "Not allowed");
err!(GenericErrorCode::NotFound, "Missing id {}", id);