some stack miss when error is thrown in eval()
zombieyang opened this issue · 2 comments
zombieyang commented
example code:
var pe = new (require("pretty-error"));
try {
eval(`(function fn(){
throw new Error('some error');
})()`)
} catch(e) {
console.log(e.stack);
console.log(pe.render(e));
}
result:
Error: some error
at fn (eval at <anonymous> (S:\_TEST_\index.js:4:2), <anonymous>:2:9)
at eval (eval at <anonymous> (S:\_TEST_\index.js:4:2), <anonymous>:3:4)
at Object.<anonymous> (S:\_TEST_\index.js:4:2)
at Module._compile (module.js:570:32)
Error: some error
- index.js:4 Object.<anonymous>
S:/_TEST_/index.js:4:2
- module.js:570 Module._compile
module.js:570:32
zombieyang commented
https://github.com/AriaMinaei/pretty-error/blob/master/src/ParsedError.coffee#L109
The problem is caused by the RegExp here. It does not match (eval at <anonymous> (S:\_TEST_\index.js:4:2), <anonymous>:2:9)
aight8 commented
please fix this