ump45nose commented on code in PR #4939:
URL: https://github.com/apache/arrow-adbc/pull/4939#discussion_r4480819658


##########
r/adbcdrivermanager/R/error.R:
##########
@@ -75,6 +75,15 @@ stop_for_error <- function(status, error) {
     # Store the listified error information
     cnd$error <- error
 
+    # R truncates printed error messages to getOption("warning.length")
+    # characters (1000 by default), which cuts off long driver manager
+    # messages such as the list of paths searched for a driver manifest.
+    # The limit applies to the whole printed message, including the
+    # "Error in <call> :" prefix, so always raise it to its maximum while
+    # the error is signalled; the option is restored when stop() unwinds.

Review Comment:
   Agreed, applied in fd8cd23. (AI-assisted reply.)



##########
r/adbcdrivermanager/tests/testthat/test-error.R:
##########
@@ -41,6 +41,33 @@ test_that("error allocator works", {
   expect_identical(err$details, setNames(list(), character()))
 })
 
+test_that("stop_for_error() does not truncate long error messages", {
+  # Long messages (e.g., the list of paths searched for a driver manifest)
+  # should not be cut off at the default warning.length of 1000 characters
+  old_options <- options(warning.length = 1000L)
+  on.exit(options(old_options))
+
+  warning_length_while_signalled <- NULL
+  had_error <- FALSE
+  tryCatch(
+    withCallingHandlers(
+      adbc_driver(paste0("not_a_driver_", strrep("x", 1000))),

Review Comment:
   Thanks! The test needs the printed message to exceed 1000 bytes, which the 
long name currently guarantees. Once #4995 lands I can shorten the name to a 
valid filename component (e.g. under 255 bytes) and check the message length 
still exceeds the default limit, or rebase onto it if you prefer. (AI-assisted 
reply.)



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