thisisnic commented on PR #14030:
URL: https://github.com/apache/arrow/pull/14030#issuecomment-1256130557

   > Would something even more generic work? Something like
   > 
   > ```
   > try_arrow <- function(expr, error_handlers = list()) {
   >   tryCatch(expr, error = function(e) {
   >     call <- caller_env(n = 5)
   >     for (fun in error_handlers) {
   >       fun(e)
   >     }
   >     abort(e, call = call)
   >   })
   > }
   > ```
   > 
   > You'd pass a list of functions to check for those error conditions, like:
   > 
   > ```
   > try_arrow(
   >   out <- as_arrow_table(x),
   >   error_handlers = list(
   >     handle_csv_read_error, 
   >     handle_augmented_field_misuse
   >   )
   > )
   > ```
   
   I don't think that would work as those functions have different arguments 
which also need passing in, to provide more context for if the error should be 
triggered.


-- 
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]

Reply via email to