Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewhickman/fn-error-context
An attribute macro to add context to errors from a function.
https://github.com/andrewhickman/fn-error-context
Last synced: 22 days ago
JSON representation
An attribute macro to add context to errors from a function.
- Host: GitHub
- URL: https://github.com/andrewhickman/fn-error-context
- Owner: andrewhickman
- License: apache-2.0
- Created: 2020-03-29T15:23:28.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-20T23:59:04.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T01:42:41.372Z (9 months ago)
- Language: Rust
- Size: 37.1 KB
- Stars: 17
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
[![Crates.io][ci]][cl] [![Docs.rs][di]][dl]
[ci]: https://img.shields.io/crates/v/fn-error-context.svg
[cl]: https://crates.io/crates/fn-error-context/[di]: https://docs.rs/fn-error-context/badge.svg
[dl]: https://docs.rs/fn-error-context/# 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 {
let text = read_to_string(path)?;
Ok(text.parse()?)
}
```