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

debug() when JSON.parse() on a response body fails #1700

Merged
merged 1 commit into from Jul 29, 2015

Conversation

phillipj
Copy link
Contributor

Previously JSON.parse() failures was silently ignored.

Although response.body would still contain the invalid JSON response body as a string, instead of a JS object, it's valueable to know the JSON was invalid while debugging.

I was tempted to .emit('error', new Error('Invalid JSON received')) but that might be a little harse.

Any thoughts?

Previously JSON.parse() failures was silently ignored.
Although `response.body` would still contain the invalid JSON response
body as a string, instead of a JS object, it's valueable to know
the JSON was invalid while debugging.
simov added a commit that referenced this pull request Jul 29, 2015
debug() when JSON.parse() on a response body fails
@simov simov merged commit 7a42a98 into request:master Jul 29, 2015
@simov
Copy link
Member

simov commented Jul 29, 2015

Yep, seems good. Emitting error there won't be good as there are plenty of consumers that handle this case by themselves already.

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.

None yet

2 participants