Repository navigation
Inaccurate error message when using negative index in cell path - #18282
Conversation
sholderbach
left a comment
There was a problem hiding this comment.
Thanks for catching that!
Lokks good to me.
If you are looking for perfect standardization you could also verify the other locations where a command converts ints to cell paths if they use the same message. Came across the following less specific NeedsPositiveValue on a quick grep:
nushell/crates/nu-protocol/src/value/from_value.rs
Lines 729 to 739 in ed10eca
Thanks for the review. |
|
Thanks! |
|
Can you update the User Facing changes section please? |
Done. |
Description
This PR should close #18281
After applying this patch.
User-facing changes (Release notes)
Improved errors for negative indices in cell paths
Improved error messages when negative indices are used in cell paths.
Previously, negative indices could produce misleading "Row number too large" errors (e.g.,
[["foo", "bar"], ["foo", "baz"]] | get 0.-1) or generic "NeedsPositiveValue" errors (e.g.,["foo", "bar", "baz"] | get (-1)).Now Nushell reports clear messages such as "negative index is not supported in cell path" or "can't convert negative number to cell path".
Additional notes