futuresimple/api_client — pull request #6 by pithyless (2013-09-26 09:58:32+00:00)
Title: Add request and response data to ApiClient::Errors

In order to better support logging and debugging errors, it would be nice to access the original request and response when rescuing an ApiClientError.

This PR adds two attr_readers (`request` and `response`) to ApiClientError and friends.

```
def foo
rescue ApiClient::Errors::BadRequest => e
e.message # No change
HoneyBadger.context(request: e.request) # {method: method, path: path, data: data, headers: headers}
logger.debug(e.response) # original response
end
```

This PR does not change the exception messages from the previous release, so it should be backwards compatible.

What do you think?