Closed SamuelLeeD closed 3 years ago
@SamuelLeeD I think for the normal case, we can give a better error message by returning what is in error_message
.
For example, here is http_status()
vs the message we can give by checking the error_message
("The series does not exist" is quite nice to tell the user)
Browse[2]> httr::http_status(response)
$category
[1] "Client error"
$reason
[1] "Bad Request"
$message
[1] "Client error: (400) Bad Request"
Browse[2]> message
[1] "400: Bad Request. The series does not exist."
However, I do think that we can use http_status()
if it is an "unknown" error format. I'll add that to #98
Right now
httr::content(resp)
doesn't return a vector, so trying to access theerror_code
anderror_message
columns fromerr
doesn't do anything and gives an empty error message. Usinghttr::http_status(resp)
works quite neatly, showing both the status code and error message correctly.