sc_last_error {STATcubeR} | R Documentation |
Error handling for the STATcube REST API
Description
In case API requests are unsuccessful, STATcubeR
will throw errors
to summarize the httr error type and its meaning.
Requests are considered unsuccessful if one of the following applies
The response returns
TRUE
forhttr::http_error()
.The response is not of type
"application/json"
In some cases it is useful to get direct access to a faulty response object.
For that purpose, it is possible to use sc_last_error()
which will provide
the httr response object for the last unsuccessful request.
Usage
sc_last_error()
sc_last_error_parsed()
Value
The return value from httr::GET()
or httr::POST()
.
Functions
-
sc_last_error_parsed()
: returns the last error as a list containing the response content and the response status
Examples
try(sc_table_saved("invalid_id"))
last_error <- sc_last_error()
httr::content(last_error)
str(sc_last_error_parsed())
[Package STATcubeR version 1.0.0 Index]