Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 2x 2x 2x 2x 2x 73x 73x 16x 16x 16x 16x 21x 21x 21x 84x 84x 6x 78x 21x | 'use strict';
const errorRe = /^[\w\d]+(:.*)?(?:(\r?\n\s+at.*)+|\r?\n$)/m;
const errorPropsRe = /^([\w\d]+)(: (.*))?\r?\n/;
const frameRe = /^\s+at(.*)\(?(.*):(\d+):(\d+(?:-\d+)?)\)?/;
exports.parse = parse;
exports.parseStack = parseStack;
function parse(str) {
let match = str.match(errorRe);
if (!match) return null;
const errorStr = match[0];
match = errorStr.match(errorPropsRe);
Iif (!match) return null;
return {
name: match[1],
message: match[3],
stack: parseStack(errorStr.slice(match[0].length))
};
}
function parseStack(stackStr) {
const stack = [];
const lines = stackStr.split(/\r?\n/g);
lines.forEach(entry => {
const match = entry.match(frameRe);
if (match === null) {
return;
}
stack.push({
source: entry,
functionName: match[1].trim(),
fileName: match[2],
lineNumber: Number(match[3]),
columnNumber: Number(match[4])
});
});
return stack;
}
|