You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We know that a mismatch error is classed with a vctrs subscript oob error (as of the most recent update) and also stores the problematic selection in $i:
I fully acknowledge that these are not part of the official API, so I do not mean to build on top of this pattern. Instead, I was hoping that tidyselect could throw more specific, classed errors, where possible. For example, it'd be nice for an empty selection error with allow_empty = FALSE to look something like this:
cli::cli_abort("Must select at least one item.", call=call)
}
}
I realize that this is a non-trivial ask that probably requires a lot of deliberation, but I was curious whether this is within scope / planned to be worked on. Thanks in advance for considering!
The text was updated successfully, but these errors were encountered:
Geez I'm just seeing that #350 partially addresses this -- sorry for the noise. My issue is not a complete duplicate but pretty close, so please feel free to close this issue if you decide to merge that other PR.
A user's attempt at selecting a column can fail for various reasons - currently, there are some (extremely brittle) ways to infer what went wrong.
Briefly, if we wanted to distinguish between these three types of tidyselect errors (mismatch, other evaluation error, empty):
We know that a mismatch error is classed with a vctrs subscript oob error (as of the most recent update) and also stores the problematic selection in
$i
:An error from evaluating the user-supplied expression gets chained, so these errors are distinguished by having a
$parent
:Lastly, an empty selection that's promoted to an error with
allow_empty = FALSE
has neither$i
nor a$parent
:I fully acknowledge that these are not part of the official API, so I do not mean to build on top of this pattern. Instead, I was hoping that tidyselect could throw more specific, classed errors, where possible. For example, it'd be nice for an empty selection error with
allow_empty = FALSE
to look something like this:... by adding the
"tidyselect_error_*"
class where the error gets thrown:tidyselect/R/eval-walk.R
Lines 128 to 132 in fd22cc1
I realize that this is a non-trivial ask that probably requires a lot of deliberation, but I was curious whether this is within scope / planned to be worked on. Thanks in advance for considering!
The text was updated successfully, but these errors were encountered: