Handle anonymous stack frames correctly

parse-stacktrace-fix
Sven Slootweg 4 years ago
parent bae1f0e9fc
commit 1a97d4ee09

@ -114,7 +114,10 @@ function removeInternalFrames(stack) {
let internalBasePath = getInternalBasePath(); let internalBasePath = getInternalBasePath();
return stack.filter((frame) => { return stack.filter((frame) => {
return (!frame.location.path.startsWith(internalBasePath)); return (
!frame.location.anonymous
&& !frame.location.path.startsWith(internalBasePath)
);
}); });
} }

@ -18,16 +18,20 @@ function maybeTrim(value) {
} }
function parseLocation(locationString) { function parseLocation(locationString) {
let match = positionRegex.exec(locationString); if (locationString === "<anonymous>") {
return { anonymous: true };
if (match != null) {
return {
path: match[1],
line: parseInt(match[2]),
column: parseInt(match[3])
};
} else { } else {
throw new Error(`Could not parse location from string: ${locationString}`); let match = positionRegex.exec(locationString);
if (match != null) {
return {
path: match[1],
line: parseInt(match[2]),
column: parseInt(match[3])
};
} else {
throw new Error(`Could not parse location from string: ${locationString}`);
}
} }
} }

Loading…
Cancel
Save