Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: expressjs/body-parser
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c4b9a0b496e4b18876e8c9e0bb21c5749717c493
Choose a base ref
..
head repository: expressjs/body-parser
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0f75d30d7112ec3a25e717ee28a5e8e6db7c46a3
Choose a head ref
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/types/json.js
13 changes: 7 additions & 6 deletions lib/types/json.js
Original file line number Diff line number Diff line change
@@ -88,7 +88,10 @@ function json (options) {
debug('parse json')
return JSON.parse(body, reviver)
} catch (e) {
throw normalizeJsonSyntaxError(e)
throw normalizeJsonSyntaxError(e, {
message: e.message,
stack: e.stack
})
}
}

@@ -206,11 +209,9 @@ function normalizeJsonSyntaxError (error, obj) {
}
}

if (obj) {
// replace stack before message for Node.js 0.10 and below
error.stack = obj.stack.replace(error.message, obj.message)
error.message = obj.message
}
// replace stack before message for Node.js 0.10 and below
error.stack = obj.stack.replace(error.message, obj.message)
error.message = obj.message

return error
}