Files
bun.sh/test/js/node/process/process-uncaughtExceptionCaptureCallback.js
Jarred Sumner 45d0c1432b rewrite timers for setTimeout, setInterval, setImmediate (#11419)
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <=>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: gvilums <gvilums@users.noreply.github.com>
2024-05-30 02:11:12 -07:00

33 lines
681 B
JavaScript

let monitorCalled = false;
setTimeout(async () => {
console.log("setTimeout");
// uncaughtExceptionMonitor should be called
if (!monitorCalled) {
process.exit(1);
}
// timeouts should be processed
process.exit(42);
}, 1);
process.on("uncaughtExceptionMonitor", err => {
console.log("uncaughtExceptionMonitor");
monitorCalled = true;
if (!err) {
process.exit(1);
}
});
process.setUncaughtExceptionCaptureCallback(err => {
console.log("setUncaughtExceptionCaptureCallback");
// there should be an error
if (!err) {
process.exit(1);
}
});
throw new Error("error");
// this shouldn't be hit even if the exception is caught
process.exit(1);