-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update OOB errors #1737
base: main
Are you sure you want to change the base?
Update OOB errors #1737
Conversation
lionel-
commented
Oct 21, 2022
•
edited
Loading
edited
- Use standard subscript error header in OOB errors.
- Use actual vs expected phrasing.
- Merge OOB and non-consecutive OOB errors. Instead of a specific error, just mention in an info bullet that consecutive extension is allowed.
- When multiple locations are problematic, mention them in their own cross bullet.
165cb4f
to
18fc8e1
Compare
! Can't subset elements that don't exist. | ||
x Elements `foo` and `bar` don't exist. | ||
! Can't subset elements with `i`. | ||
x Can't find elements `foo` and `bar`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a case where chained errors might fit better because there are multiple bullets "can't / must" bullets describing a problem at different levels.
Same for the "must" cross bullet above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an improvement, but it feels like we can still do even better, so I'd like to push this off until the next release so we can spend more time on it, and do it once.
@@ -22,24 +22,24 @@ | |||
Output | |||
<error/vctrs_error_subscript_oob> | |||
Error in `vec_slice()`: | |||
! Can't subset elements that don't exist. | |||
x Element `foo` doesn't exist. | |||
! Can't subset elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need "Can't subset elements" in these three errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is that this is this header that carries the arg
information, if any. That will be the case when called from select()
and tibble's subset methods.
! Can't subset elements past the end. | ||
i Location 10 doesn't exist. | ||
! Can't subset elements with `10`. | ||
x Location must be less than or equal to 2, not 10. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be one line like Can't find location 10; input is length 2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly problematic because these errors are used for subsetting across tibble rows and cols. So it's hard to find generic formulations that work well for all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could say "input has 2 elements" or "input has 3 rows". This is how we currently phrase it in an additional info bullet, but I guess you're saying this information should be closer?
Another difficult aspect is how to handle the case where multiple locations are not found without creating a too long line. To address this, I try to consistently mention multiple locations in their own bullet in this PR. But then it's hard to keep the length info close.
420c834
to
ad93a63
Compare