mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Refactor error make
(#10923)
- Replaced `start`/`end` with span. - Fixed standard library. - Add `help` option. - Add a couple more errors for invalid record types. Resolve #10914 # Description # User-Facing Changes - **BREAKING CHANGE:** `error make` now takes in `span` instead of `start`/`end`: ```Nushell error make { msg: "Message" label: { text: "Label text" span: (metadata $var).span } } ``` - `error make` now has a `help` argument for custom error help.
This commit is contained in:
@ -54,13 +54,11 @@ fn filesize_format_auto_metric_false() {
|
||||
fn fancy_default_errors() {
|
||||
let actual = nu!(nu_repl_code(&[
|
||||
r#"def force_error [x] {
|
||||
let span = (metadata $x).span;
|
||||
error make {
|
||||
msg: "oh no!"
|
||||
label: {
|
||||
text: "here's the error"
|
||||
start: $span.start
|
||||
end: $span.end
|
||||
span: (metadata $x).span
|
||||
}
|
||||
}
|
||||
}"#,
|
||||
@ -78,13 +76,11 @@ fn narratable_errors() {
|
||||
let actual = nu!(nu_repl_code(&[
|
||||
r#"$env.config = { error_style: "plain" }"#,
|
||||
r#"def force_error [x] {
|
||||
let span = (metadata $x).span;
|
||||
error make {
|
||||
msg: "oh no!"
|
||||
label: {
|
||||
text: "here's the error"
|
||||
start: $span.start
|
||||
end: $span.end
|
||||
span: (metadata $x).span
|
||||
}
|
||||
}
|
||||
}"#,
|
||||
|
Reference in New Issue
Block a user