Skip to content

Commit

Permalink
Disable stack traces for normal errors in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Mar 13, 2024
1 parent 1bf43c3 commit 95b3ec7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/hyperqueue/src/bin/hq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,16 @@ async fn main() -> hyperqueue::Result<()> {
}));

// Also enable backtraces by default.
// This enables backtraces when panicking, but also for normal anyhow errors.
std::env::set_var("RUST_BACKTRACE", "full");

// This further disables backtraces for normal anyhow errors.
// They should not be printed to users in release mode.
#[cfg(not(debug_assertions))]
{
std::env::set_var("RUST_LIB_BACKTRACE", "0");
}

let matches = RootOptions::command().get_matches();
let top_opts = match RootOptions::from_arg_matches(&matches) {
Ok(opts) => opts,
Expand Down

0 comments on commit 95b3ec7

Please sign in to comment.