diff --git a/DESCRIPTION b/DESCRIPTION index 321b6837..a0ac332b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -77,4 +77,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/utils.R b/R/utils.R index a8fec2b8..215cc104 100644 --- a/R/utils.R +++ b/R/utils.R @@ -87,6 +87,8 @@ report_card_template_goshawk <- function(title, #' #' This function returns choices based on the class of the input. #' If the input is of class `delayed_data`, it returns the `subset` of the input. +#' If `subset` is NULL and the input contains `var_label` and `var_choices`, +#' it throws an error prompting to resolve delayed inputs. #' Otherwise, it returns the input as is. #' #' @param choices An object that contains choices. @@ -94,7 +96,18 @@ report_card_template_goshawk <- function(title, #' @keywords internal get_choices <- function(choices) { if (inherits(choices, "delayed_data")) { - choices$subset + if (is.null(choices$subset)) { + if (!is.null(choices$var_label) && !is.null(choices$var_choices)) { + stop( + "Resolve delayed inputs by evaluating the code within the provided datasets. + Check ?teal.transform::resolve_delayed for more information." + ) + } else { + stop("Subset is NULL and necessary fields are missing.") + } + } else { + choices$subset + } } else { choices } diff --git a/man/get_choices.Rd b/man/get_choices.Rd index 56cd5af1..a4e7229e 100644 --- a/man/get_choices.Rd +++ b/man/get_choices.Rd @@ -15,6 +15,8 @@ A vector of choices. \description{ This function returns choices based on the class of the input. If the input is of class \code{delayed_data}, it returns the \code{subset} of the input. +If \code{subset} is NULL and the input contains \code{var_label} and \code{var_choices}, +it throws an error prompting to resolve delayed inputs. Otherwise, it returns the input as is. } \keyword{internal}