Macro oofs::oof

source · []
macro_rules! oof {
    ($($arg:tt)*) => { ... };
}
Expand description

Create a custom error Oof similar to anyhow!

You can format the error just like you do for println! and anyhow!.

Ex)

return oof!("custom error {}", "failure").into_res();

Oof::into_res() wraps Oof in Result::Err(_), so you can return it directly.

Since the macro returns Oof, you can chain methods like tag and attach.

Ex)

struct MyTag;

let x = 123usize;

return oof!("custom error {}", "failure").tag::<MyTag>().attach(x).into_res();