Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was 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

Description

@misterdjules

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions