At the moment, HTTP status codes different than 200 are completely ignored. This leads to confusing error messages that don't help clients debug the issue quickly. Adding a check for the return status code helps ensure a more meaningful error message can be returned.
Ideally, the body of the response should be logged rather than provided in the exception message. In the absence of a logging framework in the library however, I think emitting the body in the message can help debugging.
Happy to adapt as needed if you have any feedback.
At the moment, HTTP status codes different than 200 are completely ignored. This leads to confusing error messages that don't help clients debug the issue quickly. Adding a check for the return status code helps ensure a more meaningful error message can be returned.
Ideally, the body of the response should be logged rather than provided in the exception message. In the absence of a logging framework in the library however, I think emitting the body in the message can help debugging.
Happy to adapt as needed if you have any feedback.