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.
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.