Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logic on failing to parse the result #33

Merged
merged 2 commits into from
May 9, 2018

Conversation

adamJaffe2
Copy link

@adamJaffe2 adamJaffe2 commented May 9, 2018

  • Callback with the status instead of a JSON parse error

I was experiencing an issue where Foursquare was sending a status 400, however the result was not parsable. This resulted in my callback getting called with "Unexpected end of JSON input" instead of a 400. I experienced this issue with version v0.3.2, but it seems that this will still be an issue with what is currently in v0.4.0.

  * Callback with the status instead of a JSON parse error
@clintandrewhall
Copy link
Owner

Nice fix... how about we meet halfway? We could return an object with both error and status code... and update any error handling to return this structure. That way, we get the best of both worlds, and we get consistent logging. Thoughts?

@adamJaffe2
Copy link
Author

Sounds good to me. Would passing the callback an object with two keys status and error be inline with what you're thinking?

@clintandrewhall clintandrewhall merged commit c8648a4 into clintandrewhall:master May 9, 2018
clintandrewhall added a commit that referenced this pull request Jul 12, 2018
Update logic on failing to parse the result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants