Skip to content

Commit df8b4e4

Browse files
committed
Exclude eval information when parsing Chrome stacks. Fixes #25
1 parent eed552f commit df8b4e4

8 files changed

+38
-6
lines changed

dist/error-stack-parser-with-polyfills.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/error-stack-parser-with-polyfills.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/error-stack-parser.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'use strict';
1515

1616
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+\:\d+/;
17-
var CHROME_IE_STACK_REGEXP = /\s+at .*(\S+\:\d+|\(native\))/;
17+
var CHROME_IE_STACK_REGEXP = /\s*at .*(\S+\:\d+|\(native\))/;
1818

1919
return {
2020
/**
@@ -60,6 +60,11 @@
6060
return error.stack.split('\n').filter(function (line) {
6161
return !!line.match(CHROME_IE_STACK_REGEXP);
6262
}, this).map(function (line) {
63+
if (line.indexOf('(eval at ') > -1) {
64+
// TODO: we need a way of representing location within eval()'d String
65+
// throw away all intermediate "eval at XXX" and location within eval()'d string
66+
line = line.replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, '');
67+
}
6368
var tokens = line.replace(/^\s+/, '').split(/\s+/).slice(1);
6469
var locationParts = this.extractLocation(tokens.pop());
6570
var functionName = tokens.join(' ') || undefined;

dist/error-stack-parser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)