mirror of
https://github.com/nushell/nushell.git
synced 2025-07-24 09:45:33 +02:00
# Description Before this PR, errors without error codes are printed somewhat strangely, with the `×` and the description being printed on the same line as the `Error:` text: Error: × Invalid literal ╭─[entry #1:1:2] 1 │ "\z" · ─┬─ · ╰── unrecognized escape after '\' in string ╰──── This PR adds a default error code for the different error types: Error: nu::parser::error × Invalid literal ╭─[entry #1:1:2] 1 │ "\z" · ─┬─ · ╰── unrecognized escape after '\' in string ╰──── While maybe not as informative as a proper error code, it makes `GenericError`s and other things which don't have error codes look a lot nicer. It would be nicer if we could just set `diagnostic(code: "nu:🐚:error")` at the top of `ShellError`, but unfortunately you can't set a "default" at the `enum` level and then override it in the variants. @cptpiepmatz mentioned he might change miette's derive macro to accommodate this, in that case we can switch the approach here. # User-Facing Changes * Errors without error codes now have a default error code corresponding to from which part of Nushell the error occurred (shell, parser, compile, etc) --------- Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com>
nu-protocol
The nu-protocol crate holds the definitions of structs/traits that are used throughout Nushell. This gives us one way to expose them to many other crates, as well as make these definitions available to each other, without causing mutually recursive dependencies.