JS Exception Stack: Parsing JSON JS Exception Stack: Parsing JSON json json

JS Exception Stack: Parsing JSON


Well even with:

$ node --builtins-in-stack-traces test.js

And test.js:

var invalidJson = '{ this is bad }';//Make err.stack return an array of CallSite objects instead of stringError.prepareStackTrace = function(_, stack) {    return stack;};try {    JSON.parse( invalidJson );}catch (exc) {    var asd = exc.stack;}asd.forEach( function(v){    console.log((v.getMethodName() || v.getFunctionName()) +         ":" + v.getLineNumber());});

The output is:

MakeGenericError:118MakeSyntaxError:324parse:56null:9_compile:456.js:474load:356_load:312runMain:497startup:119

Doesn't seem possible from Javascript, you should file a bug to expose the JSON line number information to JS since they are obviously accessing it when doing the ^--- thing. JSON should not be hand written so syntax errors shouldn't be common unless the JSON serializer being used is somehow broken.