diff --git a/DESCRIPTION b/DESCRIPTION index 885b1b6c3..f13aa2d4a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -51,4 +51,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/R/construction_helpers.R b/R/construction_helpers.R index 6672b1e1f..fe1bd3c17 100644 --- a/R/construction_helpers.R +++ b/R/construction_helpers.R @@ -123,12 +123,22 @@ construct_model.survey.design <- function(data, formula, method, method.args = l ) } -.as_list_of_exprs <- function(x) { +.as_list_of_exprs <- function(x, arg_name = "method.args") { x_enexpr <- enexpr(x) + if (is_call_simple(x_enexpr)) { + return(call_args(x_enexpr)) + } + if (tryCatch(inherits(x, "list"), error = \(x) FALSE)) { return(x) } - call_args(x_enexpr) + + cli::cli_abort( + c("There was an error processing the {.arg {argname}} argument.", + i = "Expecting a simple call. See {.help rlang::is_call_simple} for details." + ), + call = get_cli_abort_call() + ) } #' @rdname construction_helpers