eyre-rs / color-eyre

Custom hooks for colorful human oriented error reports via panics and the eyre crate
Other
960 stars 56 forks source link

add `suppress_backtrace` method #113

Closed chris-laplante closed 2 years ago

chris-laplante commented 2 years ago

In my application, there are certain errors that are mundane enough that I don't really need a backtrace. But I still want to be able to propagate the error using all the nice eyre machinery I've set up. This PR adds a suppress_backtrace method which lets you do just that.

To expand a bit: in my application's main I set RUST_BACKTRACE to 1:

// Automatically enable backtracing unless user explicitly disabled it
if env::var("RUST_BACKTRACE").is_err() {
    env::set_var("RUST_BACKTRACE", "1");
}

This is so that when people report problems with my application, it will always spit out a useful backtrace that they can provide.

chris-laplante commented 2 years ago

Thanks :)