From 7d1a59c5b94edb7ecb38665492afdf184494e28b Mon Sep 17 00:00:00 2001 From: Daniel Sjoberg Date: Sun, 30 Jun 2024 12:51:07 -0700 Subject: [PATCH] progress --- DESCRIPTION | 2 +- R/construction_helpers.R | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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..54954213d 100644 --- a/R/construction_helpers.R +++ b/R/construction_helpers.R @@ -123,12 +123,21 @@ 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