MCPcopy Index your code
hub / github.com/nodejs/node / test4

Function test4

test/parallel/test-domain-uncaught-exception.js:70–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68});
69
70function test4() {
71 // This test creates two nested domains: d5 and d6. d6 doesn't register an
72 // error handler. When the timer's callback is called, because async
73 // operations like timer callbacks are bound to the domain that was active
74 // at the time of their creation, and because both d5 and d6 domains have
75 // exited by the time the timer's callback is called, its callback runs with
76 // only d6 on the domains stack. Since d6 doesn't register an error handler,
77 // the process' uncaughtException event should be emitted.
78 const d5 = domain.create();
79 const d6 = domain.create();
80
81 d5.on('error', function onErrorInD2Domain() {
82 process.send('errorHandledByDomain');
83 });
84
85 d5.run(function() {
86 d6.run(function() {
87 setTimeout(function onTimeout() {
88 throw new Error('boom!');
89 }, 1);
90 });
91 });
92}
93
94tests.push({
95 fn: test4,

Callers

nothing calls this directly

Calls 5

sendMethod · 0.65
setTimeoutFunction · 0.50
createMethod · 0.45
onMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…