nealrichardson commented on a change in pull request #9893:
URL: https://github.com/apache/arrow/pull/9893#discussion_r607395443



##########
File path: r/R/util.R
##########
@@ -86,3 +86,16 @@ all_names <- function(expr) {
 is_constant <- function(expr) {
   length(all_vars(expr)) == 0
 }
+
+read_compressed_error <- function(e) {
+  e <- as.character(e)
+  compression <- sub(".*Support for codec '(.*)'.*", "\\1", e)

Review comment:
       I still think that this function is problematic because it assumes that 
the only error you could get is about a codec. To illustrate:
   
   ```
   > tryCatch(stop("BANG BANG"), error = arrow:::read_compressed_error)
   Error: Unsupported compressed format Error in doTryCatch(return(expr), name, 
parentenv, handler): BANG BANG
   
   Try setting the environment variable LIBARROW_MINIMAL=false and reinstalling
   for a more complete installation (including Error in 
doTryCatch(return(expr), name, parentenv, handler): BANG BANG
   ) or setting
   ARROW_WITH_ERROR IN DOTRYCATCH(RETURN(EXPR), NAME, PARENTENV, HANDLER): BANG 
BANG
   =ON and reinstalling to enable support for this codec.
   ```
   
   You may be interested to compare with how I did something similar in 
https://github.com/apache/arrow/pull/9899/files#diff-f6235d4767fc4a7ee1bb726d816b9742ef0bc07503dceb678fd3bc55ee15454bR90-R96




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to