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

Check for JSON before parsing JSON in errors #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JimPatterson
Copy link

@JimPatterson JimPatterson commented Oct 20, 2021

The createError function was incorrectly assuming that response
bodies are in JSON format and attempting to extract useful details
from that body. But, for some error cases, the body is not JSON
resulting in a error being thrown during the process of adding
details to the error.

This fix adds safeguards around the places that need JSON to enable
the createError method to extract the useful details.

This likely fixes #110 and fixes #118.

The createError function was incorrectly assuming that response
bodies are in JSON format and attempting to extract useful details
from that body.  But, for some error cases, the body is not JSON
resulting in a error being thrown during the process of adding
details to the error.

This fix adds safeguards around the places that need JSON to enable
the createError method to extract the useful details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant