Skip to content

Commit

Permalink
fix: parse JSON from GitHub error messages
Browse files Browse the repository at this point in the history
BREAKING CHANGE: error.message is no longer a JSON string containing GitHub’s error message. Instead the JSON is parsed internally and error properties are assigned with its value. This is not technically a breaking change but a bug fix, but as this bug was around for a long time and plenty of apps depend on `JSON.parse(error.message)` to be working, we treat it as a breaking change by way of precaution
  • Loading branch information
gr2m committed Nov 17, 2018
1 parent 69a212f commit dd6306e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/request/request.js
Expand Up @@ -99,6 +99,12 @@ function request (requestOptions) {

.catch(error => {
if (error instanceof HttpError) {
try {
Object.assign(error, JSON.parse(error.message))
} catch (_error) {
// ignore, see #684
}

throw error
}

Expand Down

0 comments on commit dd6306e

Please sign in to comment.