Skip to content
This repository has been archived by the owner on Dec 21, 2017. It is now read-only.

Add request to api errors #17

Merged
merged 3 commits into from
Apr 7, 2015
Merged

Add request to api errors #17

merged 3 commits into from
Apr 7, 2015

Conversation

greysteil
Copy link
Contributor

Hugely useful when debugging API errors.

@greysteil
Copy link
Contributor Author

@english - can you review?

def error
@error ||=
if response.json?
response.body['error']
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering whether we may as well just use response.body here on the off chance we don't get back what we're expecting, i.e. no error field. I'm not sure whether that's ever going to happen since if an error gets returned not through our error serializer, its also likely not going to be json. What do you think? Might be really handy if it every happens!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good shout - let's put the response.body into the "Unknown error" text below.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@english
Copy link

english commented Apr 7, 2015

One comment, but looks good otherwise 👍

greysteil added a commit that referenced this pull request Apr 7, 2015
@greysteil greysteil merged commit b1d902e into dev Apr 7, 2015
@greysteil greysteil deleted the add-request-to-api-errors branch April 7, 2015 14:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants