You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stacktrace.js misnumbers columns after applying a source map.
This is probably because the source maps spec says that lines and columns are 0-based, whereas browsers generally start counting at 1.
Strangely however the issue doesn't seem to affect line numbers, only columns.
Test case demonstrating the bug:
letStackTrace=require("stacktrace-js");// No source map: the stack trace says that the error occurred at// line 1 column 1.letcode="error_at_line_1_column_1()\n"+"//# sourceURL=code.js\n";letsourceCache={"code.js": code};try{eval(code);}catch(err){StackTrace.fromError(err,{ sourceCache }).then(stack=>{console.log("No source map:");console.log(stack[0]);});}// Add a source map. Now it'll say give the error at// line 1 column 0.code+="//# sourceMappingURL=code.js.map\n";letsourceMap={version: 3,sources: ["mapped.js"],mappings: "AAAA"};sourceCache={"code.js": code,"code.js.map": JSON.stringify(sourceMap)};try{eval(code);}catch(err){StackTrace.fromError(err,{ sourceCache }).then(stack=>{console.log("With source map:")console.log(stack[0]);});}
Stacktrace.js misnumbers columns after applying a source map.
This is probably because the source maps spec says that lines and columns are 0-based, whereas browsers generally start counting at 1.
Strangely however the issue doesn't seem to affect line numbers, only columns.
Test case demonstrating the bug:
Script output:
The text was updated successfully, but these errors were encountered: