Skip to content

Commit aa7a7ef

Browse files
committed
Don't error on CRAN but throw warning
This allows to no be blocked right now by CRAN checks
1 parent 137124b commit aa7a7ef

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

R/utils.R

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ check_params_for_na <- function(x) {
133133
# Found NA values (excluding NaN which is mathematically valid)
134134
na_positions <- which(is.na(data) & !is.nan(data))
135135
n_na <- length(na_positions)
136-
137-
cli::cli_abort(c(
136+
warn_or_error(c(
138137
"{.code NA} values detected in parameter {.field {path}}",
139138
"x" = "Found NA at position{if (n_na > 1) 's' else ''}: {.val {na_positions}}",
140139
"i" = "Quarto CLI uses YAML 1.2 spec which cannot process R's {.code NA} values",
@@ -151,6 +150,18 @@ check_params_for_na <- function(x) {
151150
}
152151

153152

153+
warn_or_error <- function(message, ..., .envir = parent.frame()) {
154+
if (is_cran_check()) {
155+
msg <- c(
156+
message,
157+
"!" = "This warning will become an error in future versions of Quarto R package."
158+
)
159+
cli::cli_warn(message = msg, ..., .envir = .envir)
160+
} else {
161+
cli::cli_abort(message = message, ..., .envir = .envir)
162+
}
163+
}
164+
154165
# inline knitr:::merge_list()
155166
merge_list <- function(x, y) {
156167
x[names(y)] <- y

0 commit comments

Comments
 (0)