Check for an http error.
Arguments
- x
Object to check. Default methods are provided for strings (which perform an
HEAD()
request), responses, and integer status codes.- ...
Other arguments passed on to methods.
See also
Other response methods:
content()
,
http_status()
,
response()
,
stop_for_status()
Examples
if (FALSE) {
# You can pass a url:
http_error("http://www.google.com")
http_error("http://httpbin.org/status/404")
# Or a request
r <- GET("http://httpbin.org/status/201")
http_error(r)
}
# Or an (integer) status code
http_error(200L)
#> [1] FALSE
http_error(404L)
#> [1] TRUE