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

Need SyntaxError location when require() failed in uncaughtException handler #5297

Closed
strrchr opened this issue Feb 18, 2016 · 4 comments
Closed
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@strrchr
Copy link

strrchr commented Feb 18, 2016

After search, I found these two issues related:
#3784
#4013

It seems node-5.2 fix this bug.
But after I install node-5.6, I found it only be fixed in REPL.
In script require() another script, these is no locatoin infomation when require() failed.

@cjihrig
Copy link
Contributor

cjihrig commented Feb 18, 2016

This should be fixed in master as of 5700352.

@strrchr
Copy link
Author

strrchr commented Feb 18, 2016

Sorry for my misunderstanding.
My problem is in uncaughtException handler, there is no syntax error location.
The following two scripts shows the problem:
error_location_main.js

process.on('uncaughtException', function (err) {
  console.log('uncaughtException:', (err instanceof Error) && err.stack || err);
});
require("./error_location_lib.js");

error_location_lib.js

var fs = require("fs");
fs.stat("aaa", function (err, stats) {
}

On node-5.6, run error_location_main.js, I got:

uncaughtException: SyntaxError: missing ) after argument list
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (D:\home\js\modules_by_me\levelnode\try\error_location_main.js:7:1)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

@strrchr strrchr changed the title Need SyntaxError location when require() failed Need SyntaxError location when require() failed in uncaughtException handler Feb 18, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Feb 18, 2016

Yea, the fix currently only lives in master. It was marked as semver-major, so it won't be in a release for a while.

@strrchr
Copy link
Author

strrchr commented Feb 18, 2016

Very thanks for your explanation. I got it!

@strrchr strrchr closed this as completed Feb 18, 2016
@ChALkeR ChALkeR added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Feb 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

3 participants