diff --git a/lib/types/json.js b/lib/types/json.js index 078ce710..e5d3f009 100644 --- a/lib/types/json.js +++ b/lib/types/json.js @@ -68,7 +68,9 @@ function json (options) { if (first !== '{' && first !== '[') { debug('strict violation') - throw createStrictSyntaxError(body, first) + var err = createStrictSyntaxError(body, first) + Error.captureStackTrace(err) + throw err } } @@ -198,9 +200,6 @@ function normalizeJsonSyntaxError (error, 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 - return error }