Skip to content

Nushell error messages should only display "backtrace" info message when it will change the output #15070

@NotTheDr01ds

Description

@NotTheDr01ds

Related problem

#14945 is nice, but most Nushell CLI errors aren't going to have a bracktrace. Having the

let string = oops-this-is-a-command-position
# => Error: nu::shell::external_command
# => 
# =>   × External command failed
# =>    ╭─[entry #7:1:14]
# =>  1 │ let string = oops-this-is-a-command-position
# =>    ·              ───────────────┬───────────────
# =>    ·                             ╰── Command `oops-this-is-a-command-position` not found
# =>    ╰────
# =>   help: `oops-this-is-a-command-position` is neither a Nushell built-in or a known external command
# => 
# => set the `NU_BACKTRACE=1` environment variable to display a backtrace.

Setting NU_BACKTRACE isn't going to change anything, except to get rid of the last two lines of the error above.

Describe the solution you'd like

Either only display the NU_BACKTRACE info message if there is more than one error in the chain (if possible) or, can we just get rid of that message altogether and make it part of the documentation instead? While useful, I don't know that it's going to be as critical as having a backtrace on a panic, and Nushell errors are very common compared to panics.

Side-note: The message should reference $env.NU_BACKTRACE = 1 rather than the POSIX-style.

Describe alternatives you've considered

No response

Additional context and details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)A:error-unhelpfulThe error message you observe is not helpful to identify the problemcategory:enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions