Closed moiristo closed 6 months ago
We could add http_code
and http_headers
to the exception object. Similar to https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/exceptions.rb#L129.
That would be fine. That exception class also has an accessor for the response of course. I'm not sure if the plan in that case is to set http_code
and http_headers
based on response data and still drop the original response itself?
I'd prefer users don't rely on an implementation detail such as the underlying HTTP library. Is there anything you might need besides the code, headers, and body?
@justincase no, I don't think so. If the http library needs to be interchangeable, then I think adding http_headers
is indeed the way to go.
When a rate limit error occurs, I'd like to read out the 'retry-after' header. Unfortunately, the actual response (including headers) is not passed when the
Mollie::RequestError
is raised:https://github.com/mollie/mollie-api-ruby/blob/bde1a0be0ed58d15f5560e6e442941bc0a3425ab/lib/mollie/client.rb#L137
I think it makes sense to pass the original response?