- Version: v15.14.0
- Platform: all
- Subsystem: process/execution
What steps will reproduce the bug?
- Register an
uncaughtExceptionMonitor handler on process, which itself throws
- Throw an error without catching it
How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior?
uncaughtException event on process to be fired, if error is handled don't crash the process.
- Ideally with an
AggregateError containing both errors
- But at least with the original error
What do you see instead?
The process simply dies with error code 7. uncaughtException isn't emitted.
Additional information
Example file:
process.addListener('uncaughtExceptionMonitor', (e) => {
console.error('Monitored Error!', e);
throw new Error('Oopsie!');
});
process.addListener('uncaughtException', e => {
console.error('Handled error!', e);
})
let i = 0;
setInterval(() => console.log(i++), 1000);
throw new Error('Thrown!');
Expected
Monitored: ...
Handled: ...
0
1
2
...
Actual
Monitored: ...
/path/to/test.js:3
throw new Error('Oopsie!');
^
Error: Oopsite!
at ...
$ # process died, error code is 7
What steps will reproduce the bug?
uncaughtExceptionMonitorhandler onprocess, which itself throwsHow often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior?
uncaughtExceptionevent onprocessto be fired, if error is handled don't crash the process.AggregateErrorcontaining both errorsWhat do you see instead?
The process simply dies with error code
7.uncaughtExceptionisn't emitted.Additional information
Example file:
Expected
Actual