From cb2848325c4f579f489a9ccc84840666f2ff35fc Mon Sep 17 00:00:00 2001 From: ProfessorP Date: Thu, 16 May 2024 11:02:57 -0400 Subject: [PATCH] updated assertion_filter_cond by adding gsub() argument to line 520 so that the error message returned for arg_name returns inputs wrapped in functionsby themselves without the function. So instead of expr(filter_add) in the error message its filter_add --- NEWS.md | 2 ++ R/assertions.R | 2 ++ 2 files changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 17a01502..91a31fc9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,8 @@ ## Updates of Existing Functions +* Updated `assertions_filter_cond` by adding a `gsub()` argument on line 520 so that error messages return `filter_add` instead of `enexpr(filter_add)`. + * Error messaging throughout the package have been updated from `rlang::abort()` to `cli::cli_abort()`. As a part of the update, each of the `assert_*()` functions have new arguments `assert_*(message, arg_name, call, class).` (#367) * Warning messaging has also been updated to use `{cli}` messaging. diff --git a/R/assertions.R b/R/assertions.R index 8d2f20cd..13ec1c7c 100644 --- a/R/assertions.R +++ b/R/assertions.R @@ -517,6 +517,8 @@ assert_filter_cond <- function(arg, return(invisible(arg)) } + arg_name <- gsub("^.*\\((.*)\\)$", "\\1", arg_name) + provided <- !is_missing(arg) if (provided && !(is_call(arg) || is_logical(arg))) { cli_abort(