Skip to content

Commit d9a4252

Browse files
authored
Fix API registration error (#89)
1 parent 7d54d15 commit d9a4252

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

R/api_helpers.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -769,17 +769,17 @@ validate_api_request <- function(res, call = caller_env()) {
769769
# if any error details exist.
770770
if (length(error_details) > 0) {
771771
error_details <- c("x" = "Invalid IPUMS registration", error_details)
772+
} else {
773+
# Otherwise we should be dealing with a valid registration but invalid key
774+
error_details <- c(
775+
"x" = "The provided API key is either missing or invalid.",
776+
"i" = paste0(
777+
"Please provide your API key to the `api_key` argument ",
778+
"or request a key at https://account.ipums.org/api_keys"
779+
),
780+
"i" = "Use `set_ipums_api_key()` to save your key for future use."
781+
)
772782
}
773-
774-
# Otherwise we should be dealing with a valid registration but invalid key
775-
error_details <- c(
776-
"x" = "The provided API key is either missing or invalid.",
777-
"i" = paste0(
778-
"Please provide your API key to the `api_key` argument ",
779-
"or request a key at https://account.ipums.org/api_keys"
780-
),
781-
"i" = "Use `set_ipums_api_key()` to save your key for future use."
782-
)
783783
}
784784

785785
# If a downloads request, add hint to inform of possible issue

0 commit comments

Comments
 (0)