Attach line & file info to anyhow::Error and anyhow::Context
- Dominant language
- Rust
- Stars
- 6.7k
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Description
First off, thank you for this wonderful library!
### Context
It's often difficult to find where in your code an error occurred. Rust's backtraces help with this, but are often so verbose that it's still difficult.
### Proposal
It would be great if you could simply glance at the error output to get file and line information. This could be implemented using `#[track_caller]` and can be optionally turned on using a feature flag.
I'm not sure what format you'll want, but I'm imagining something like this:
```
Error: Failed to parse file: hello.txt @ main.rs:7:10
Caused by:
0: Unable to convert this string into a float: '1.5a' @ main.rs:19:24
1: invalid float literal @ main.rs:25:32
Stack backtrace:
...
```
I'm willing to make a PR if you like this feature!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.