diff --git a/R/items-funs.R b/R/items-funs.R index acba1efc..749b5b6b 100644 --- a/R/items-funs.R +++ b/R/items-funs.R @@ -355,8 +355,9 @@ items_next.STACItemCollection <- function(items, ...) { matched <- items_matched(items) q <- doc_query(items) - if (is.null(q)) + if (is.null(q)) { .error("Cannot get next link URL", class = "next_error") + } # get url of the next page next_url <- Filter(function(x) x$rel == "next", items$links) @@ -420,7 +421,6 @@ items_next.STACItemCollection <- function(items, ...) { content <- post_request(next_stac, ..., encode = q$encode) } else { - .error("Invalid HTTP method.") } @@ -430,7 +430,6 @@ items_next.STACItemCollection <- function(items, ...) { # check pagination length if (!is.null(q$params[["limit"]]) && items_length(content) > as.numeric(q$params[["limit"]])) { - .error("STAC invalid retrieved page length.") } @@ -438,7 +437,6 @@ items_next.STACItemCollection <- function(items, ...) { if (!is.null(matched) && !is.null(q$params[["limit"]]) && (items_length(content) != as.numeric(q$params[["limit"]])) && (items_length(content) + items_length(items) != matched)) { - .error("STAC pagination error.") } diff --git a/tests/testthat/test-signatures.R b/tests/testthat/test-signatures.R index 902fa250..58f46d77 100644 --- a/tests/testthat/test-signatures.R +++ b/tests/testthat/test-signatures.R @@ -94,6 +94,14 @@ testthat::test_that("signature functions", { class = c("STACItemCollection", "RSTACDocument") ) + # provided wrong url + testthat::expect_error( + object = suppressWarnings( + items_sign(stac_items, + sign_fn = sign_planetary_computer(token_url = "test")) + ) + ) + # return the same object after signature? testthat::expect_s3_class( object = suppressWarnings( @@ -123,12 +131,4 @@ testthat::test_that("signature functions", { object = href_item, regexp = "se" ) - - # provided wrong url - testthat::expect_error( - object = suppressWarnings( - items_sign(stac_items, - sign_fn = sign_planetary_computer(token_url = "test")) - ) - ) })