Skip to content

Commit

Permalink
use cli_abort
Browse files Browse the repository at this point in the history
  • Loading branch information
eroten committed Dec 18, 2023
1 parent f135bc4 commit cd0cd28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions R/geojson_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ as.geo_list <- function(x, from) structure(x, class = "geo_list", from = from)

lint_polygon_list <- function(x) {
if (!identical(x[[1]], x[[length(x)]])) {
stop("First and last point in a polygon must be identical",
cli::cli_abort("First and last point in a polygon must be identical",
call. = FALSE
)
}
Expand Down Expand Up @@ -362,7 +362,7 @@ num_to_geo_list <- function(x, geometry = "point", type = "FeatureCollection") {
geom <- capwords(match.arg(geometry, c("point", "polygon")))
res <- tryCatch(as.numeric(x), warning = function(e) e)
if (inherits(res, "simpleWarning")) {
stop("Coordinates are not numeric", call. = FALSE)
cli::cli_abort("Coordinates are not numeric", call. = FALSE)
} else {
switch(type,
FeatureCollection = {
Expand Down Expand Up @@ -538,7 +538,7 @@ guess_latlon <- function(x, lat = NULL, lon = NULL) {
}
return(list(lon = lngs, lat = lats))
} else {
stop("Couldn't infer longitude/latitude columns, please specify with 'lat'/'lon' parameters", call. = FALSE)
cli::cli_abort("Couldn't infer longitude/latitude columns, please specify with 'lat'/'lon' parameters", call. = FALSE)
}
} else {
return(list(lon = lon, lat = lat))
Expand Down
3 changes: 1 addition & 2 deletions R/upload_zone_set.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ upload_zone_set <- function(login_email,
# check that there aren't too many zones
# check_zone_size(zones = zones_sf)
if (nrow(zones_sf) >= 7000) {
stop(("There are too many zones in this zone set."))
return()
cli::cli_abort("There are too many zones in this zone set.")
}

# if the coordinate reference system is not WGS84, transform
Expand Down

0 comments on commit cd0cd28

Please sign in to comment.