R/handle_download_error.R

Defines functions handle_download_error

#' @keywords internal
#'
handle_download_error <- function(download_function, ..., fallback = NULL) {
  tryCatch(
    {
      download_function(...)
    },
    error = function(e) {
      cli::cli_inform(paste0(
        "Failed to download or process the resource. ",
        "The resource may not be available, or the URL may have changed. ",
        "Error message: {.message {e$message}}"
      ))
      fallback
    }
  )
}

Try the tidyfinance package in your browser

Any scripts or data that you put into this service are public.

tidyfinance documentation built on April 3, 2025, 6:10 p.m.