If a filename has spaces in it, it throws off the tokenization of the stackframe, resulting in an incorrect StackFrame object. The filename is reported as everything after the space, e.g.
Parsing this error…
Error
at Object.<anonymous> (/Users/bengourley/Development/error-stack-parser/scratch/my project/index.js:2:9)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
The fix is a little clunky I'll admit – the neatest thing would be to find a regex to supply instead of the split(/\s+/) call, which would only split on spaces that did not occur with parentheses, but I couldn't come up with one.
Motivation and Context
Reported on this repo #46 and now Bugsnag's users are seeing it bugsnag/bugsnag-js#586.
How Has This Been Tested?
Added a test case which fails before the fix is applied.
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] node_modules/.bin/jscs -c .jscsrc error-stack-parser.js passes without errors
Description
If a filename has spaces in it, it throws off the tokenization of the stackframe, resulting in an incorrect
StackFrame
object. The filename is reported as everything after the space, e.g.Parsing this error…
Results in this at
stackframe[0]
:The fix is a little clunky I'll admit – the neatest thing would be to find a regex to supply instead of the
split(/\s+/)
call, which would only split on spaces that did not occur with parentheses, but I couldn't come up with one.Motivation and Context
Reported on this repo #46 and now Bugsnag's users are seeing it bugsnag/bugsnag-js#586.
How Has This Been Tested?
Added a test case which fails before the fix is applied.
Types of changes
Checklist:
node_modules/.bin/jscs -c .jscsrc error-stack-parser.js
passes without errorsnpm test
passes without errors