Macro manyhow::bail

source ·
macro_rules! bail {
    ($msg:literal) => { ... };
    ($error:expr) => { ... };
    ($($tt:tt)*) => { ... };
}
Expand description

Exit by returning error, matching anyhow::bail!.

The syntax is identical to error_message!, the only difference is, that a single expression with an error is supported as well.

bail!("an error message"; error = "with attachments");
let span = Span::call_site();
bail!(span, "error message");
let error = syn::Error::new(Span::call_site(), "an error");
bail!(error);