errify

Attribute Macro errify 

Source
#[errify]
Expand description

Macro that provides error context on entire function. Supports async functions.

Constraints are T: Display + Send + Sync + 'static and E: WrapErr.

§Syntax

#[errify( $( $fmt:literal $(, $arg:expr)* ) | $expr:expr )]

§Usage example

§Format string with arguments

use errify::errify;

#[errify("Custom error context, with argument capturing {arg} = {}", arg)]
fn func(arg: i32) -> Result<(), CustomError> {
    // ...
}

§Expression

use errify::errify;

#[errify(String::from("Custom error context"))]
fn func(arg: i32) -> Result<(), CustomError> {
    // ...
}