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

Disable stack traces for normal errors in release mode #687

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading