mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Make group-by
return errors in closure (#12508)
# Description When a closure if provided to `group-by`, errors that occur in the closure are currently ignored. That is, `group-by` will fall back and use the `"error"` key if an error occurs. For example, the code snippet below will group all `ls` entries under the `"error"` column. ```nushell ls | group-by { get nope } ``` This PR changes `group-by` to instead bubble up any errors triggered inside the closure. In addition, this PR also does some refactoring and cleanup inside `group-by`. # User-Facing Changes Errors are now returned from the closure provided to `group-by` instead of falling back to the `"error"` group/key.
This commit is contained in:
@ -53,9 +53,7 @@ fn errors_if_given_unknown_column_name() {
|
||||
"#
|
||||
)));
|
||||
|
||||
assert!(actual
|
||||
.err
|
||||
.contains("requires a table with one value for grouping"));
|
||||
assert!(actual.err.contains("can't convert list<string> to string"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user