diff --git a/r/R/dataset-format.R b/r/R/dataset-format.R index fcdcffedf1c..60ede3553ac 100644 --- a/r/R/dataset-format.R +++ b/r/R/dataset-format.R @@ -427,7 +427,11 @@ csv_file_format_parse_opts <- function(...) { # Catch cases when the user specifies a mix of Arrow C++ options and # readr-style options if (!all(is_readr_opt)) { - stop("Use either Arrow parse options or readr parse options, not both", call. = FALSE) + abort(c( + "CSV parse options must be either Arrow-style or readr-style, not both.", + i = sprintf("Arrow options used: %s.", oxford_paste(opt_names[is_arrow_opt])), + i = sprintf("readr options used: %s.", oxford_paste(opt_names[is_readr_opt])) + )) } do.call(readr_to_csv_parse_options, opts) # all options have readr-style names } else { diff --git a/r/tests/testthat/test-dataset-csv.R b/r/tests/testthat/test-dataset-csv.R index ce3f94e7f56..8e6f5aa6f31 100644 --- a/r/tests/testthat/test-dataset-csv.R +++ b/r/tests/testthat/test-dataset-csv.R @@ -231,7 +231,7 @@ test_that("readr parse options", { ) # With both Arrow and readr parse options (disallowed) - expect_error( + err <- expect_error( open_dataset( tsv_dir, partitioning = "part", @@ -239,8 +239,10 @@ test_that("readr parse options", { quote = "\"", quoting = TRUE ), - "either" + "Arrow-style or readr-style" ) + expect_match(conditionMessage(err), "Arrow options used:.*quoting") + expect_match(conditionMessage(err), "readr options used:.*quote") # With ambiguous partial option names (disallowed) expect_error(