From a8a844ac88ed1729af24d8688112d27b1e945ee0 Mon Sep 17 00:00:00 2001 From: Rich FitzJohn Date: Tue, 10 Sep 2024 13:46:55 +0100 Subject: [PATCH] Propagate name parameter in match_value Originally fixed in https://github.com/mrc-ide/orderly2/pull/175 --- R/standalone-utils-assert.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/standalone-utils-assert.R b/R/standalone-utils-assert.R index 2768aa7..d0b84de 100644 --- a/R/standalone-utils-assert.R +++ b/R/standalone-utils-assert.R @@ -67,7 +67,7 @@ assert_logical <- function(x, name = deparse(substitute(x)), assert_nonmissing <- function(x, name = deparse(substitute(x)), - arg = name, call = parent.frame()) { + arg = name, call = parent.frame()) { if (anyNA(x)) { cli::cli_abort("Expected '{name}' to be non-NA", arg = arg, call = call) } @@ -235,7 +235,7 @@ assert_named <- function(x, unique = FALSE, name = deparse(substitute(x)), match_value <- function(x, choices, name = deparse(substitute(x)), arg = name, call = parent.frame()) { - assert_scalar_character(x, call = call, arg = arg) + assert_scalar_character(x, call = call, name = name, arg = arg) if (!(x %in% choices)) { choices_str <- paste(sprintf("'%s'", choices), collapse = ", ") cli::cli_abort(c("'{name}' must be one of {choices_str}",