nushell/crates/nu-command/src/commands
Andrés N. Robalino c9c6bd4836
Create errors from tables. (#3986)
```
> [
  [          msg,                 labels,                      span];
  ["The message", "Helpful message here", ([[start, end]; [0, 141]])]
] | error make

error: The message
  ┌─ shell:1:1
  │
1 │ ╭ [
2 │ │   [          msg,                 labels,                      span];
3 │ │   ["The message", "Helpful message here", ([[start, end]; [0, 141]])]
  │ ╰─────────────────────────────────────────────────────────────────────^ Helpful message here
```

Adding a more flexible approach for creating error values. One use case, for instance is the
idea of a test framework. A failed assertion instead of printing to the screen it could create
tables with more details of the failed assertion and pass it to this command for making a full
fledge error that Nu can show. This can (and should) be extended for capturing error values as well
in the pipeline. One could also use it for inspection.

For example: `.... | error inspect { # inspection here }`

or "error handling" as well, like so: `.... | error capture { fix here }`

However, we start here only with `error make` that creates an error value for you with limited support for the time being.
2021-09-02 21:07:26 -05:00
..
charting Allow different names for ...rest (#3954) 2021-08-27 05:58:53 +12:00
config Begin directory contrib docs and split commands (#3650) 2021-06-19 12:06:44 +12:00
conversions Add subcommand into filesize (#3987) 2021-09-02 18:19:54 -05:00
core_commands Create errors from tables. (#3986) 2021-09-02 21:07:26 -05:00
dataframe Allow different names for ...rest (#3954) 2021-08-27 05:58:53 +12:00
env nu-path crate refactor (#3730) 2021-08-28 15:59:09 +03:00
filesystem nu-path crate refactor (#3730) 2021-08-28 15:59:09 +03:00
filters Allow different names for ...rest (#3954) 2021-08-27 05:58:53 +12:00
formats Reimplement parsers with nu-serde (#3880) 2021-08-06 11:46:19 -05:00
generators Allow different names for ...rest (#3954) 2021-08-27 05:58:53 +12:00
math Begin directory contrib docs and split commands (#3650) 2021-06-19 12:06:44 +12:00
network Move sys, ps, fetch, post to internal commands (#3983) 2021-09-01 14:29:09 +12:00
path nu-path crate refactor (#3730) 2021-08-28 15:59:09 +03:00
pathvar Support other variables than PATH in pathvar (2nd attempt) (#3828) 2021-07-24 11:44:36 -05:00
platform nu-path crate refactor (#3730) 2021-08-28 15:59:09 +03:00
random Bump rand version used by nu-command to 0.8 (#3723) 2021-07-05 16:12:44 +12:00
shells Begin directory contrib docs and split commands (#3650) 2021-06-19 12:06:44 +12:00
strings Update char_.rs (#3975) 2021-08-29 08:40:28 -05:00
system Move sys, ps, fetch, post to internal commands (#3983) 2021-09-01 14:29:09 +12:00
viewers All is a DataFrame (#3812) 2021-07-25 22:01:54 +12:00
mod.rs Create errors from tables. (#3986) 2021-09-02 21:07:26 -05:00