Skip to content

Commit

Permalink
Stopped overwriting proxy_settings when using "default"
Browse files Browse the repository at this point in the history
  • Loading branch information
HadleyBN committed Nov 17, 2023
1 parent d223207 commit 47bb1ab
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,27 @@ fingertips_deframe <- function(data) {
#' @noRd
fingertips_proxy_settings <- function() {

# First try using default as proxy settings
fingertips_proxy <- "default"
fingertips_proxy <- tryCatch(
errtext <- tryCatch(
{
fingertips_ensure_api_available(proxy_settings = "default")
}, error=function(e) {"none"}
}, error=function(e) {"The API is currently unavailable."}
)

if (fingertips_proxy == "none") {
# Second try using "none" as proxy settings
if (errtext != TRUE) {
fingertips_proxy <- "none"
errtext <- tryCatch(
{
fingertips_ensure_api_available(proxy_settings = "none")
}, error=function(e) {"The API is currently unavailable."}
)
{
fingertips_ensure_api_available(proxy_settings = "none")
}, error=function(e) {"The API is currently unavailable."}
)

# Stop if neither settings work
if (errtext != TRUE) {
stop(paste(errtext, collapse='\n '), call. = FALSE)
}
}
}
return(fingertips_proxy)
}

0 comments on commit 47bb1ab

Please sign in to comment.