Remove BACKTRACE message for non-panic errors (#15143)

# Description

Resolves #15070 by removing the `BACKTRACE` message from all Nushell
(non-panic) errors. This was added in #14945 and is useful for
debugging, but not all that helpful to the typical shell user,
especially since most shell errors won't have a backtrace anyway.

At some point it would be nice to display this message only when there
*is* a backtrace available.

# User-Facing Changes

Error messages will be more concise.

# Tests + Formatting

Updated tests.

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

We should include information in the *"Custom Commands"* chapter of the
documentation on how to enable this for debugging.
This commit is contained in:
Douglas
2025-02-20 02:59:11 -05:00
committed by GitHub
parent 3d58c3f70e
commit 4a967d19a9
2 changed files with 1 additions and 6 deletions

View File

@ -50,10 +50,6 @@ pub fn report_compile_error(working_set: &StateWorkingSet, error: &CompileError)
fn report_error(working_set: &StateWorkingSet, error: &dyn miette::Diagnostic) {
eprintln!("Error: {:?}", CliError(error, working_set));
let have_no_backtrace = working_set.get_env_var("NU_BACKTRACE").is_none();
if have_no_backtrace {
eprintln!("set the `NU_BACKTRACE=1` environment variable to display a backtrace.")
}
// reset vt processing, aka ansi because illbehaved externals can break it
#[cfg(windows)]
{