[
https://issues.apache.org/jira/browse/ARROW-13370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17461612#comment-17461612
]
Dewey Dunnington commented on ARROW-13370:
------------------------------------------
I've run into this too, but I don't have a list handy of where this matters so
that we can test it on something realistic (the example that Jon posted works
now instead of erroring!).
There's a comment in the source about using a classed error...a potential
implementation might look like this:
{code:R}
arrow_not_supported <- function(what) {
lab <- format(sys.call(-1))
rlang::abort(
glue::glue("`{lab}`: { what } not supported in Arrow"),
class = "arrow_not_supported"
)
}
arrow_eval <- function(expr) {
withCallingHandlers({
force(expr)
}, error = function(e) {
if (inherits(e, "arrow_not_supported")) {
rlang::abort(conditionMessage(e), parent = e)
} else {
rlang::abort("You tried something that isn't supported", parent = e)
}
})
}
arrow_eval("ok")
#> [1] "ok"
arrow_eval(stop("uninformative message"))
#> Error: You tried something that isn't supported
arrow_eval(identity(arrow_not_supported("this specific thing")))
#> Error: `identity(arrow_not_supported("this specific thing"))`: this specific
thing not supported in Arrow
{code}
> [R] More special handling for known errors in arrow_eval
> --------------------------------------------------------
>
> Key: ARROW-13370
> URL: https://issues.apache.org/jira/browse/ARROW-13370
> Project: Apache Arrow
> Issue Type: New Feature
> Components: R
> Reporter: Neal Richardson
> Priority: Major
> Fix For: 7.0.0
>
>
> We have special handling in arrow_eval that looks for the "not supported in
> Arrow" error, and when that's found it shows the error message rather than
> swallowing it in an "Expression not supported" message. But we have other
> error messages we raise in nse_funcs that are worth showing--bad input etc.
> Use a sentinel error message that we can also detect and subclass as
> "arrow-try-error" like the others, or (better) raised a classed exception (if
> that's supported in all versions of R we support).
--
This message was sent by Atlassian Jira
(v8.20.1#820001)