Skip to content

Commit

Permalink
Merge b9d2974 into ec05742
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosbosse authored Jun 1, 2022
2 parents ec05742 + b9d2974 commit 4255507
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/input-check-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,19 @@ check_true_values <- function(true_values,
#' @param ... The variables to check
#' @return The function returns `NULL`, but throws an error if the variable is
#' missing.
#' @example
#' test_function <- function(argument = NULL) {
#' scoringutils:::check_not_null("argument" = argument)
#' paste("Input:", argument)
#' }
#' test_function("works")
#'
#' @keywords internal
check_not_null <- function(...) {
vars <- list(...)
varnames <- names(vars)

calling_function <- deparse1(sys.calls()[[sys.nframe() - 1]])
calling_function <- deparse(sys.calls()[[sys.nframe() - 1]])

for (i in seq_along(vars)) {
varname <- varnames[i]
Expand Down Expand Up @@ -165,7 +171,7 @@ check_equal_length <- function(...,
}

if (length(unique(lengths)) != 1) {
calling_function <- deparse1(sys.calls()[[sys.nframe() - 1]])
calling_function <- deparse(sys.calls()[[sys.nframe() - 1]])
stop(paste0(
"Arguments passed to the following function call: '",
calling_function,
Expand Down

0 comments on commit 4255507

Please sign in to comment.