Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Process' uncaughtException is not emitted if error is thrown within top-level domain's error handler #8665

Closed
misterdjules opened this issue Nov 3, 2014 · 0 comments

Comments

@misterdjules
Copy link

➜  node-0.10 git:(v0.10) cat test-top-level-domain.js

process.on('uncaughtException', function onUncaught(e) {
    console.log('Uncaught exception:', e);
});

var domain = require('domain');
var d = domain.create();

d.on('error', function() {
    throw new Error('You should see me');
});

d.run(function doStuff() {
    throw new Error("You should NOT see me");
});
➜  node-0.10 git:(v0.10) ./node test-top-level-domain.js 

/Users/JulienGilli/test-top-level-domain.js:14
    throw new Error("You should NOT see me");
          ^
Error: You should NOT see me
    at doStuff (/Users/JulienGilli/dev/node/test-top-level-domain.js:14:11)
    at b (domain.js:183:18)
    at Domain.run (domain.js:123:23)
    at Object.<anonymous> (/Users/JulienGilli/dev/node/test-top-level-domain.js:13:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
➜  node-0.10 git:(v0.10)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants