From f4e39a0151045acd33934dd0cefdb09a69d99489 Mon Sep 17 00:00:00 2001 From: olivroy Date: Mon, 4 Dec 2023 16:39:53 -0500 Subject: [PATCH] Make code more uniform. --- R/utils.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/utils.R b/R/utils.R index 78024bf87a..c93b263ce8 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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}}.", @@ -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 ) }