You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.
If I make a call to an api using the above code and the remote service returns http 404, Resty throws an IOException. This isn't what I expect. It should return to me a JSONResource with a response code 404.
int statusCode = jsonResource.http().getResponseCode();
// statusCode == 404
404 isn't an exceptional case, it is a standard, expected response from an http call.
Throwing an exception, especially a checked exception, is wrong. Clients need to react differently to 2xx, 3xx, 4xx, and 5xx type response, wrapping every non 2xx http in a checked exception hides important information.
The text was updated successfully, but these errors were encountered:
I find the use of Exceptions incorrect.
For example,
JSONResource jsonResource = resty.json(url);
If I make a call to an api using the above code and the remote service returns http 404, Resty throws an IOException. This isn't what I expect. It should return to me a JSONResource with a response code 404.
404 isn't an exceptional case, it is a standard, expected response from an http call.
Throwing an exception, especially a checked exception, is wrong. Clients need to react differently to 2xx, 3xx, 4xx, and 5xx type response, wrapping every non 2xx http in a checked exception hides important information.
The text was updated successfully, but these errors were encountered: