Skip to content

Commit

Permalink
Propagate name parameter in match_value
Browse files Browse the repository at this point in the history
Originally fixed in
mrc-ide/orderly2#175
  • Loading branch information
richfitz committed Sep 10, 2024
1 parent f33edf2 commit a8a844a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/standalone-utils-assert.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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}",
Expand Down

0 comments on commit a8a844a

Please sign in to comment.