nealrichardson commented on code in PR #12839:
URL: https://github.com/apache/arrow/pull/12839#discussion_r847673797
##########
r/R/csv.R:
##########
@@ -200,8 +200,8 @@ read_delim_arrow <- function(file,
tryCatch(
tab <- reader$Read(),
- error = function(e) {
- handle_csv_read_error(e, schema)
+ error = function(e, call = caller_env(n = 4)) {
Review Comment:
Feels brittle but it's probably fine. I'd just leave in some comments
explaining why `n = 4`, that you could have used `caller_env()` but this way is
lazy/only does it if there's an error (aside: it's just calling parent.frame(),
which on my machine takes in the hundreds of nanoseconds to run, so the cost of
calling it every time is not something I'm concerned about).
We can revisit later if/when we want to chain together multiple error
handlers. Also looks like rlang is growing some experimental tooling around
here (https://rlang.r-lib.org/reference/try_fetch.html) so maybe that will
mature and be ready whenever we revisit this.
In sum, seems like you've thought this through, so just leave a note
explaining why this non-obvious thing is there and 👍 !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]