Details
-
New Feature
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
Description
We have
tryCatch(eval_tidy(expr, mask), error = function(e) { # Look for the cases where bad input was given, i.e. this would fail # in regular dplyr anyway, and let those raise those as errors; # else, for things not supported by Arrow return a "try-error", # which we'll handle differently msg <- conditionMessage(e) # TODO: internationalization? if (grepl("object '.*'.not.found", msg)) { stop(e) } if (grepl('could not find function ".*"', msg)) { stop(e) } invisible(structure(msg, class = "try-error", condition = e)) })
and tests for this behavior, but the tests are skipped because they only match correctly in an English locale because these base R messages are translated.
We can generate these regular expressions dynamically by triggering the R errors on a known nonexistent object:
> tryCatch(X_____X, error = function(e) conditionMessage(e)) [1] "object 'X_____X' not found" > tryCatch(X_____X(), error = function(e) conditionMessage(e)) [1] "could not find function \"X_____X\"" > sub("X_____X", ".*", tryCatch(X_____X, error = function(e) conditionMessage(e))) [1] "object '.*' not found"
And this will respect i18n:
> Sys.setenv(LANGUAGE="FR_fr") > sub("X_____X", ".*", tryCatch(X_____X, error = function(e) conditionMessage(e))) [1] "objet '.*' introuvable"
Attachments
Issue Links
- links to