Helper functions for httr2::req_error()
. These functions are used in
conjunction with the req_error()
function to provide additional information
about the error that occurred during the request.
Arguments
- resp
httr2::response()
object
Value
res_err_body()
- Error message as a string.res_is_err()
- Logical value indicating whether the response is an error.res_err_retry()
- Logical value indicating whether the request is retryable.
Details
The Entrata API is unique in that it always returns a 200
status code,
regardless of the success or failure of the request. To determine if a request
was successful or not, we must inspect the response body. If the response body
contains an error message, we can assume that the request was not successful.
Functions
res_err_body()
- Extracts the error code and message from the response body. Used for thebody
argument inhttr2::req_error()
.res_is_err()
- Determines if the response is an error. This is used for theis_error
argument inhttr2::req_error()
.res_err_retry()
- Determines if the request should be retried based off the response's error code.