R/util.R

Defines functions stopforstatus

Documented in stopforstatus

#' Throw an error if the RT status code is an error status
#'
#' @param response (response) An `httr` response object
#'
#' @return Either nothing, or throws an error
stopforstatus <- function(response) {
  if (response$status >= 400) {
    stop(response$message)
  }
}

Try the rt package in your browser

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

rt documentation built on May 15, 2021, 9:06 a.m.