Closed wlandau closed 2 years ago
rlang::abort(..., class = "http_400")
is a convenient alternative to stop(...)
for this.
This looks like something that would be best done in googleAuthR
or gargle
, but will investigate.
For now its implemented here via
# https://adv-r.hadley.nz/conditions.html
abort_http <- function(status_code, msg = NULL){
rlang::abort(paste0("http_",status_code),
message = paste(status_code, "error when attempting HTTP -", msg)
)
}
It would be better in googleAuthR though
This was done in googleAuthR
- thanks for idea.
When I run
tryCatch(googleCloudStorageR::gcs_get_object(...), error = function(condition_object) browser())
, on an object that does not exist, I find thatcondition_object
has classc("simpleError", "error", "condition")
. Would it be possible to throw a more specific error class for HTML error codes 400-404? For https://github.com/ropensci/targets/pull/722, this would eliminate confusion with other kinds of errors intargets:::gcp_gcs_head()
.