andrewhickman / fn-error-context

An attribute macro to add context to errors from a function.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crates.io Docs.rs

fn-error-context

An attribute macro to add context to errors from a function.

#[context("failed to parse config at `{}`", path.display())]
pub fn parse_config(path: &Path) -> anyhow::Result<u32> {
    let text = read_to_string(path)?;
    Ok(text.parse()?)
}

About

An attribute macro to add context to errors from a function.

License:Apache License 2.0


Languages

Language:Rust 100.0%