diff --git a/NEWS.md b/NEWS.md index 5715e90..1d8027e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ * Implement reading `vpts` data from a local directory (#135). * Clarify HTTP 429 error for the Netherlands (#165). +* Clarify error for Estonia and propagate call (#173). * For Romania match deviating file format (thanks to Sorin Burcea, #167). # getRad 0.2.4 diff --git a/R/get_pvol_ee.R b/R/get_pvol_ee.R index 5414404..a62a166 100644 --- a/R/get_pvol_ee.R +++ b/R/get_pvol_ee.R @@ -71,8 +71,9 @@ get_pvol_ee <- function(radar, time, ..., call = rlang::caller_env()) { httr2::resp_body_json() if (files$numFound == 0 || length(files$documents) != 1) { cli::cli_abort( - "The expected number of files is not found.", - class = "getRad_error_get_pvol_ee_differing_n_files" + "The expected number of files is not found for this Estonian Radar. This can occur when no data is available.", + class = "getRad_error_get_pvol_ee_differing_n_files", + call = call ) } pvol <- withr::with_tempfile("file", fileext = ".h5", { diff --git a/tests/testthat/test-get_pvol_ee.R b/tests/testthat/test-get_pvol_ee.R index 8a353d2..a89eb0d 100644 --- a/tests/testthat/test-get_pvol_ee.R +++ b/tests/testthat/test-get_pvol_ee.R @@ -18,3 +18,13 @@ test_that("Pvol for estonia can be downloaded", { expect_true(bioRad::is.pvol(pvol)) expect_identical(pvol$datetime, lubridate::with_tz(time, "UTC")) }) + +test_that("Pvol for estonia fails on missing data", { + expect_error( + get_pvol( + radar = "eesur", + structure(1776221700, class = c("POSIXct", "POSIXt")) + ), + class = "getRad_error_get_pvol_ee_differing_n_files" + ) +})