Skip to content

Commit

Permalink
updated assertion_filter_cond by adding gsub() argument to line 520 s…
Browse files Browse the repository at this point in the history
…o 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
  • Loading branch information
ProfessorP-beep committed May 16, 2024
1 parent 4f90007 commit cb28483
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions R/assertions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit cb28483

Please sign in to comment.