Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some stack miss when error is thrown in eval() #37

Open
zombieyang opened this issue Oct 30, 2016 · 2 comments
Open

some stack miss when error is thrown in eval() #37

zombieyang opened this issue Oct 30, 2016 · 2 comments

Comments

@zombieyang
Copy link

zombieyang commented Oct 30, 2016

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
Copy link
Author

zombieyang commented Oct 30, 2016

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
Copy link

aight8 commented Apr 13, 2017

please fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants