Skip to content

Commit

Permalink
Give more informative error when API key set
Browse files Browse the repository at this point in the history
Error message from API is now passed to user
when they request a API key for an email that
has already been assigned a key.
  • Loading branch information
wkmor1 committed Feb 9, 2024
1 parent 39848ce commit c673eb4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/finbif_request_token.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ finbif_request_token <- function(email, quiet = FALSE) {
pause_cap = getOption("finbif_retry_pause_cap"),
pause_min = getOption("finbif_retry_pause_min"),
quiet = quiet,
terminate_on = 404L
terminate_on = c(404L, 422L)
)

parsed <- httr::content(resp)
Expand All @@ -64,8 +64,8 @@ finbif_request_token <- function(email, quiet = FALSE) {

msg <- sprintf(
"API request failed [%s]\n%s",
resp[["status_code"]],
parsed[["message"]]
parsed[[c("error", "statusCode")]],
parsed[[c("error", "message")]]
)

stop(msg, call. = FALSE)
Expand Down

0 comments on commit c673eb4

Please sign in to comment.