Skip to content

Commit 334c49d

Browse files
Merge pull request #15 from oliversalzburg/feature/source-in-frame
Store the source line in the parsed frame
2 parents a7605dc + 50b2aa8 commit 334c49d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

error-stack-parser.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
var tokens = line.replace(/^\s+/, '').split(/\s+/).slice(1);
6262
var locationParts = this.extractLocation(tokens.pop());
6363
var functionName = (!tokens[0] || tokens[0] === 'Anonymous') ? undefined : tokens[0];
64-
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2]);
64+
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line);
6565
}, this);
6666
},
6767

@@ -72,7 +72,7 @@
7272
var tokens = line.split('@');
7373
var locationParts = this.extractLocation(tokens.pop());
7474
var functionName = tokens.shift() || undefined;
75-
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2]);
75+
return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line);
7676
}, this);
7777
},
7878

@@ -95,7 +95,7 @@
9595
for (var i = 2, len = lines.length; i < len; i += 2) {
9696
var match = lineRE.exec(lines[i]);
9797
if (match) {
98-
result.push(new StackFrame(undefined, undefined, match[2], match[1]));
98+
result.push(new StackFrame(undefined, undefined, match[2], match[1], lines[i]));
9999
}
100100
}
101101

@@ -110,7 +110,7 @@
110110
for (var i = 0, len = lines.length; i < len; i += 2) {
111111
var match = lineRE.exec(lines[i]);
112112
if (match) {
113-
result.push(new StackFrame(match[3] || undefined, undefined, match[2], match[1]));
113+
result.push(new StackFrame(match[3] || undefined, undefined, match[2], match[1], lines[i]));
114114
}
115115
}
116116

@@ -134,7 +134,7 @@
134134
argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, '$1');
135135
}
136136
var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? undefined : argsRaw.split(',');
137-
return new StackFrame(functionName, args, locationParts[0], locationParts[1], locationParts[2]);
137+
return new StackFrame(functionName, args, locationParts[0], locationParts[1], locationParts[2], line);
138138
}, this);
139139
}
140140
};

0 commit comments

Comments
 (0)