R/transient_errors.R

Defines functions .transient_errors

Documented in .transient_errors

#' A function used by httr2::req_retry() to determine if the response represents a transient error
#' This is a private function of 'nixtlar'
#'
#' @param resp The response to a HTTP request
#'
#' @return TRUE if the response status is 500 or 502, FALSE otherwise.
#' @export
#' @keywords internal
#' @examples
#' \dontrun{
#' .transient_errors(resp)
#' }
#'
.transient_errors <- function(resp){
  status <- httr2::resp_status(resp)
  status %in% c(500, 502) # codes considered transient
}

Try the nixtlar package in your browser

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

nixtlar documentation built on Oct. 30, 2024, 5:07 p.m.