macro_rules! bail {
($msg:literal $(,)?) => { ... };
($err:expr $(,)?) => { ... };
($fmt:expr, $($arg:tt)*) => { ... };
}Expand description
Return early with an error.
This macro is equivalent to return Err(lerror!($args...)).
The surrounding function’s or closure’s return value is required to be
Result<_,lerror::Error>.
§Example
if !has_permission(user, resource) {
bail!("permission denied for accessing {}", resource);
}