Skip to content

Commit d74fe21

Browse files
committed
fix: removed splitting 'sanitizedLine' and reorganized using 'sanitizedLine' and 'location'
1 parent 280acd5 commit d74fe21

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

error-stack-parser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
// remove the parenthesized location from the line, if it was matched
6868
sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
6969

70-
var tokens = sanitizedLine.split(/\s+/);
71-
// if a location was matched, pass it to extractLocation() otherwise pop the last token
72-
var locationParts = this.extractLocation(location ? location[1] : tokens.pop());
73-
var functionName = tokens.join(' ') || undefined;
70+
// if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine
71+
// because this line doesn't have function name
72+
var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);
73+
var functionName = location && sanitizedLine || undefined;
7474
var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
7575

7676
return new StackFrame({

0 commit comments

Comments
 (0)