tests/testthat/setup.R

# return the expression if it works, otherwise
# return empty data.frame() if it likely a 304 error
# or fail if it is likely not a 304 error
maybe_304 <- function(expr) {
  tryCatch({
  expr
  },
  error = function(e) {
    msg <- conditionMessage(e)
    if (any(grepl("304", e)) | any(grepl("503", e))) {
      data.frame()
    } else {
      stop(msg)
    }
  })
}

Try the tinytiger package in your browser

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

tinytiger documentation built on Oct. 18, 2023, 1:11 a.m.