amoeba commented on code in PR #4939:
URL: https://github.com/apache/arrow-adbc/pull/4939#discussion_r4338752458
##########
r/adbcdrivermanager/R/error.R:
##########
@@ -75,6 +75,16 @@ 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.
+ # Raise the limit to its maximum while the error is signalled so the
+ # full message is shown; the option is restored when stop() unwinds.
+ if (nchar(msg, type = "bytes") > getOption("warning.length", 1000L)) {
+ old_options <- options(warning.length = 8170L)
+ on.exit(options(old_options), add = TRUE)
+ }
+
Review Comment:
There's a slight bug in here. The truncation counts the entire error message
which includes the "Error in adbc_driver("some_driver") :" prefix to `msg`
above. So if we had a 1000-byte msg, I think it would get truncated because R
counts the entire thing.
I think we could just always raise the limit since it's cheap and I don't
think we want to implement the logic to figure out how long the "Error in..."
message will be:
```suggestion
old_options <- options(warning.length = 8170L)
on.exit(options(old_options), add = TRUE)
```
and update the comment above.
--
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]