Skip to content

Commit

Permalink
Make code more uniform.
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Dec 4, 2023
1 parent 7bbdf35 commit f4e39a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ is_nonempty_string <- function(x) {
#' @param data The input `data` object that is to be validated.
#'
#' @noRd
stop_if_not_gt_tbl <- function(data, call = rlang::caller_env()) {
# Use rlang::caller_env() to inform user of the precise location of failure.
stop_if_not_gt_tbl <- function(data, call = caller_env()) {
if (!is_gt_tbl(data = data)) {
cli::cli_abort(
"`data` must be a `gt_tbl` object, not {.obj_type_friendly {data}}.",
Expand Down Expand Up @@ -114,10 +115,10 @@ stop_if_not_gt_group <- function(data, call = caller_env()) {
#' @param data The input `data` object that is to be validated.
#'
#' @noRd
stop_if_not_gt_tbl_or_group <- function(data, call = rlang::caller_env()) {
stop_if_not_gt_tbl_or_group <- function(data, call = caller_env()) {
if (!is_gt_tbl(data = data) && !is_gt_group(data = data)) {
cli::cli_abort(
"`data` must either be a `gt_tbl` or a `gt_group`, not object{.obj_type_friendly {data}}.",
"`data` must either be a `gt_tbl` or a `gt_group`, not {.obj_type_friendly {data}}.",
call = error_call
)
}
Expand Down

0 comments on commit f4e39a0

Please sign in to comment.