Skip to content

Commit

Permalink
Clarify error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks committed Mar 14, 2024
1 parent b5cf45a commit 00653cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions R/get_power.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-internal_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down

0 comments on commit 00653cd

Please sign in to comment.