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

Process exits with incorrect message when throwing error in top-level domain's error handler #8630

Closed
misterdjules opened this issue Oct 27, 2014 · 1 comment

Comments

@misterdjules
Copy link

When running this code:

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");
});

We expect the error to bubble-up to be the one with the message "You should see me". However:

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

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-0.10 git:(v0.10) ./node test-top-level-domain.js
/Users/JulienGilli/dev/node/test-top-level-domain.js:10
    throw new Error("You should NOT see me");
          ^
Error: You cannot see me
    at doStuff (/Users/JulienGilli/dev/node/test-top-level-domain.js:10: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:9: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)
@misterdjules misterdjules added this to the 0.10.34 milestone Oct 27, 2014
@misterdjules misterdjules self-assigned this Oct 30, 2014
@misterdjules misterdjules changed the title Throwing error in top-level domain's error handler doesn't work as expected Process exits with incorrect message when throwing error in top-level domain's error handler Nov 3, 2014
misterdjules pushed a commit to misterdjules/node that referenced this issue Nov 3, 2014
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.

However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.

Fixes nodejs#8631. Also fixes nodejs#8630.
misterdjules pushed a commit to misterdjules/node that referenced this issue Nov 3, 2014
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.

However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.

Fixes nodejs#8631. Also fixes nodejs#8630.
misterdjules pushed a commit to misterdjules/node that referenced this issue Nov 3, 2014
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.

However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.

Fixes nodejs#8631. Also fixes nodejs#8630.
misterdjules pushed a commit to misterdjules/node that referenced this issue Nov 3, 2014
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.

However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.

Fixes nodejs#8631. Also fixes nodejs#8630.
misterdjules pushed a commit to misterdjules/node that referenced this issue Nov 18, 2014
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.

However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.

Fixes nodejs#8631. Also fixes nodejs#8630.
misterdjules pushed a commit to misterdjules/node that referenced this issue Nov 19, 2014
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.

However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.

Fixes nodejs#8631. Also fixes nodejs#8630.
misterdjules pushed a commit that referenced this issue Nov 19, 2014
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.

However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.

Fixes: #8631
Fixes: #8630
PR-URL: #8666
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
@trevnorris
Copy link

Fixed by caeb677.

mscdex pushed a commit to mscdex/node that referenced this issue Dec 25, 2014
Do not abort the process if an error is thrown from within a domain, an
error handler is setup for the domain and --abort-on-uncaught-exception
was passed on the command line.

However, if an error is thrown from within the top-level domain's error
handler and --abort-on-uncaught-exception was passed on the command
line, make the process abort.

Fixes: nodejs#8631
Fixes: nodejs#8630
PR-URL: nodejs#8666
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
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

2 participants