Skip to content

Commit 4b6a386

Browse files
authored
provide way to resolve 429 for the Netherlands (#166)
1 parent 70bea5f commit 4b6a386

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# getRad (development version)
22

3+
* Clarify HTTP 429 error for the Netherlands (#165).
4+
35
# getRad 0.2.4
46

57
* Make error messages more consistent (#146).

R/get_pvol_nl.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ get_pvol_nl <- function(radar, time, ..., call = rlang::caller_env()) {
7070
class = "getRad_error_get_pvol_nl_authorization_failure",
7171
call = call
7272
)
73+
},
74+
httr2_http_429 = function(cnd) {
75+
cli::cli_abort(
76+
c(
77+
"There was a rate limitation error (HTTP 429) while getting data from the Netherlands.",
78+
"i" = "This frequently occurs when using the anonymous key, if it occurs repeatedly consider requesting a registered key ({.url https://developer.dataplatform.knmi.nl/open-data-api#token}). ",
79+
"i" = "You can check the current value of {.val nl_api_key} with
80+
{.code get_secret(\"nl_api_key\")}."
81+
),
82+
cnd = cnd,
83+
class = "getRad_error_get_pvol_nl_429_failure",
84+
call = call
85+
)
7386
}
7487
)
7588
# This request retrieves the file

0 commit comments

Comments
 (0)