Macro bail

Source
macro_rules! bail {
    () => { ... };
    ($fmt:literal $(,)?) => { ... };
    ($fmt:literal, $($arg:tt)*) => { ... };
}
Expand description

Returns early with a message containing implementation details

Specifies a message using the same arguments as std::format!. This message will not be included in the ErrorObject’s message when expose_internals is set to false in Error::to_error_object.

Equivalent to return Err(Error::new(ErrorCode::INTERNAL_ERROR).with_message(format!(...), false))

§Examples

bail!();
bail!("Invalid request");
bail!("Invalid request: {}", 1);