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.

Domain error handler not preventing exception from bubbling up when --abort-on-uncaught-exception used #8631

@misterdjules

Description

@misterdjules

When passing the --abort-on-uncaught-exception command line parameter to node, the top-level domain error handler does not prevent exception from bubbling up and making the process exit.

➜  node-0.10 git:(v0.10) ✗ cat test-domain-abort-on-uncaught.js 
var domain = require('domain');
var d = domain.create();

d.on('error', function() {
  // Swallowing the error on purpose, the goal is to reproduce
  // a bug when, even if there's a top level domain error handler
  // that swallows the error, the process exits because of the
  // original exception
});

d.run(function doStuff() {
  process.nextTick(function () {
    throw new Error("You should NOT see me");
  });
});
➜  node-0.10 git:(v0.10) ✗ ./node --version
v0.10.34-pre
➜  node-0.10 git:(v0.10) ✗ ./node test-domain-abort-on-uncaught.js 
➜  node-0.10 git:(v0.10) ✗ ./node --abort-on-uncaught-exception test-domain-abort-on-uncaught.js
Uncaught Error: You should NOT see me

FROM
/Users/JulienGilli/dev/node-0.10/test-domain-abort-on-uncaught.js:13:11
process._tickDomainCallback (node.js:463:13)
Function.Module.runMain (module.js:499:11)
startup (node.js:119:16)
node.js:906:3
[1]    60143 abort      ./node --abort-on-uncaught-exception test-domain-abort-on-uncaught.js
➜  node-0.10 git:(v0.10) ✗

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions