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

Include invalid JSON body in ParseErrors #1044

Merged
merged 1 commit into from
Jan 28, 2020

Conversation

hermo
Copy link
Contributor

@hermo hermo commented Jan 28, 2020

The docs state that a ParseError includes a response as does HTTPError, for example.

A HTTPError includes response.body and PR makes ParseError behave similarly by including the invalid "JSON" in response.body. This is useful for error handling and debugging than the the SyntaxError: Unexpected token / in JSON at position 0 in the actual error message.

Checklist

  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.

@szmarczak szmarczak changed the title Include invalid JSON body in 200 parse errors Include invalid JSON body in ParseErrors Jan 28, 2020
@szmarczak szmarczak merged commit 2813b73 into sindresorhus:master Jan 28, 2020
@szmarczak
Copy link
Collaborator

Good job 🎉

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