mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 17:25:15 +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:
@ -7,8 +7,7 @@ def throw-error [error: string, msg: string, span: record] {
|
||||
msg: ($error | error-fmt)
|
||||
label: {
|
||||
text: $msg
|
||||
start: $span.start
|
||||
end: $span.end
|
||||
span: $span
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -762,11 +761,10 @@ You can also learn more at (ansi default_italic)(ansi light_cyan_underline)https
|
||||
|
||||
let span = (metadata $item | get span)
|
||||
error make {
|
||||
msg: ("std::help::item_not_found" | error-fmt)
|
||||
msg: ("std::help::item_not_found" | error-fmt)
|
||||
label: {
|
||||
text: "item not found"
|
||||
start: $span.start
|
||||
end: $span.end
|
||||
span: $span
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user