-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feature Request: Can we make filter_add
like filter
?
#453
Comments
@ddsjoberg is this one possible for us? |
We can! We'd just need to capture the input as an quosure, and pass it to We can still supplement the error message with admiral context using a variation on the code below: testing_filter <- function(data, filter_expr) {
filter_expr <- rlang::enquo(filter_expr)
tryCatch(
dplyr::filter(data, !!filter_expr),
error = \(e) {
cli::cli_abort(
c("There was an error in {.arg filter_expr}. See messaging below:",
x = conditionMessage(e))
)
}
)
}
testing_filter(mtcars, filter_expr = not_a_proper_filter_condition)
#> Error in `value[[3L]]()`:
#> ! There was an error in `filter_expr`. See messaging below:
#> ✖ ℹ In argument: `not_a_proper_filter_condition`. Caused by error: ! object
#> 'not_a_proper_filter_condition' not found Created on 2024-05-31 with reprex v2.1.0 |
@bundfussr @zdz2101 @millerg23 @kaz462 @sadchla-codes phase 2 of error messaging? |
count me in! |
That's definitely something we should improve. We could implement an We should also check if we have other cases where we pass user input to |
I think we can't catch the "unexpected '=' in" error because it is issued when the call is parsed. I.e., the function is not called if it occurs. |
Feature Idea
can we make
filter_add
likefilter
?Relevant Input
Relevant Output
No response
Reproducible Example/Pseudo Code
No response
The text was updated successfully, but these errors were encountered: