From a50ef34537520e638e01c493bc70e6c3f78a4071 Mon Sep 17 00:00:00 2001 From: "Adam H. Sparks" Date: Thu, 14 Mar 2024 14:25:26 +0800 Subject: [PATCH] Clarify error messages (#83) --- R/get_power.R | 7 ++++--- tests/testthat/test-internal_functions.R | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/R/get_power.R b/R/get_power.R index fe0349e5..5c4a4418 100644 --- a/R/get_power.R +++ b/R/get_power.R @@ -592,13 +592,13 @@ get_power <- function(community = c("ag", "re", "sb"), cli::cli_abort( call = rlang::caller_env(), c( - i = "The first {.arg lat} value must be the minimum value.") + i = "The first `lonlat` {.arg lat} value must be the minimum value.") ) } else if (lonlat[1] > lonlat[3]) { cli::cli_abort( call = rlang::caller_env(), c( - i = "The first {.arg lon} value must be the minimum value.") + i = "The first `lonlat` {.arg lon} value must be the minimum value.") ) } identifier <- "regional" @@ -611,7 +611,8 @@ get_power <- function(community = c("ag", "re", "sb"), } else { cli::cli_abort( call = rlang::caller_env(), - c(i = "You have entered an invalid request for {.arg {lonlat}}.")) + c(i = "You have entered an invalid request for `lonlat` + {.arg {lonlat}}.")) } if (!is.null(bbox)) { diff --git a/tests/testthat/test-internal_functions.R b/tests/testthat/test-internal_functions.R index a4447ab6..d6f58e62 100644 --- a/tests/testthat/test-internal_functions.R +++ b/tests/testthat/test-internal_functions.R @@ -209,14 +209,14 @@ test_that(".check_lonlat() checks order of the latitude values", { temporal_api <- "daily" expect_error(.check_lonlat(lonlat = c(-179.5, 89.5, 179.5, -89.5), pars), - regexp = "The first `lat` value must be the minimum value.") + regexp = "The first `lonlat` `lat` value must be the minimum value.") }) test_that(".check_lonlat() checks order of the longitude values", { temporal_api <- "daily" expect_error(.check_lonlat(lonlat = c(179.5, -89.5, -179.5, 89.5), pars), - regexp = "The first `lon` value must be the minimum value.") + regexp = "The first `lonlat` `lon` value must be the minimum value.") }) test_that(".check_lonlat() checks validity of bbox latmin values", {