thisisnic commented on a change in pull request #10387:
URL: https://github.com/apache/arrow/pull/10387#discussion_r644177675



##########
File path: r/R/util.R
##########
@@ -110,3 +110,11 @@ handle_embedded_nul_error <- function(e) {
   }
   stop(e)
 }
+
+is_writable_table <- function(x) {
+  inherits(x, c("data.frame", "ArrowTabular"))
+}
+
+attr(is_writable_table, "fail") <- function(call, env){
+  paste0(eval(substitute(substitute(y, env), list(y = call$x)))," is not an 
object of class 'data.frame', 'RecordBatch', or 'Table'.")

Review comment:
       I think that "must be" sounds better than "is not" after reading the 
tidyverse style guide's approach to errors since updating this PR ;) Yeah, 
makes sense - is a little more informative, will update.
   
   I'll have a look into alternatives.  My problem was that when I try it with 
`deparse(call$x)` it works when called directly like you have above, but when I 
run the unit tests and it's being called from the `write_*` functions, the 
error message then reads `x must be an object of class 'data.frame', 
'RecordBatch', or 'Table'.`.  I guess it's looking at the wrong level, but I 
wasn't sure how to get it to look at the right one.  Any ideas?




-- 
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:
[email protected]


Reply via email to