-
Notifications
You must be signed in to change notification settings - Fork 519
Open
Description
When you're doing validation on iterable data and want to report problems using error make
, it's much better to use for
than each
, as each
will throw an nu::shell::eval_block_with_input
instead of the actual error you made.
Example
for
> for x in [0] { error make { msg: "Custom error" } }
Error: × Custom error
╭─[entry #635:1:16]
1 │ for x in [0] { error make { msg: "Custom error" } }
· ─────┬────
· ╰── originates from here
╰────
each
> [0] | each { error make { msg: "Custom error" } }
Error: nu::shell::eval_block_with_input
× Eval block failed with pipeline input
╭─[entry #629:1:2]
1 │ [0] | each { error make { msg: "Custom error" } }
· ┬
· ╰── source value
╰────
Error:
× Custom error
╭─[entry #629:1:14]
1 │ [0] | each { error make { msg: "Custom error" } }
· ─────┬────
· ╰── originates from here
╰────
The fact that you get a nu::shell::eval_block_with_input
instead of the error you made of course impacts catch
blocks as well.
Metadata
Metadata
Assignees
Labels
No labels