Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short backtrace #362

Open
thewh1teagle opened this issue Apr 21, 2024 · 0 comments
Open

Short backtrace #362

thewh1teagle opened this issue Apr 21, 2024 · 0 comments

Comments

@thewh1teagle
Copy link

I have large codebase which uses anyhow::{Result, Context, bail} a lot,
and the errors don't tell much. No filename/line numbers at all.
Using RUST_BACKTRACE=1 is not convenient.

I found #22 but it will require many changes to add it everywhere.
Is there an elegant way to get short backtrace when error occur, just like we get it with unwrap()?

Example:

use anyhow::{Result, bail};

fn main() -> Result<()>  {
    job()
}

fn job() -> Result<()> {
    bail!("error in job")
}
cargo run
Error: error in job

Imagine large codebase with many errors coming from internal libraries... no idea where it happens.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant