-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
The following pseudo code:
try {
fnWhichThrows();
} catch(e) {
console.log(e.stack);
console.log(stackTrace.parse(e));
}console.log(e.stack) prints:
/path/to/source/file.js:22
(*$&@#(*!route.validate();
^
SyntaxError: Unexpected token *
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
...console.log(stackTrace.parse(e)); prints:
[ { column: 10,
file: 'vm.js',
function: 'createScript',
line: 80,
method: null,
native: false },
{ column: 10,
file: 'vm.js',
function: 'Object.runInThisContext',
line: 139,
method: 'runInThisContext',
native: false },
....
]Meaning, the parsed call stack doesn't include:
/path/to/source/file.js:22
($&@#(!route.validate();
^
which is the most important part of the stack.
In practice, this happens when require('package-name'); throws due to eg.: syntax error in the package's index.js file...
I see HERE that node-stack-trace always skips the first line of the call stack, why is that so?
Node version: 8.11.3
Metadata
Metadata
Assignees
Labels
No labels