Skip to content

Commit 4a41f70

Browse files
committed
fix: addex back uncaughtException due to undici error
1 parent 4c7d1a3 commit 4a41f70

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,18 @@ class Graceful {
9797
});
9898

9999
// handle uncaught exceptions
100-
process.on('uncaughtExceptionMonitor', (err, origin) => {
100+
// NOTE: this was commented out since we monitor `uncaughtException` instead
101+
// process.on('uncaughtExceptionMonitor', (err, origin) => {
102+
// console.error(err, { origin });
103+
// this.config.logger.fatal(err, { origin });
104+
// });
105+
106+
//
107+
// NOTE: due to undici having core issues across various node versions
108+
// we unfortunately have to listen for it specifically here
109+
// (e.g. `ConnectTimeoutError` causes an uncaught exception even with a custom dispatcher and using `undici.request` on Node v18)
110+
//
111+
process.on('uncaughtException', (err, origin) => {
101112
console.error(err, { origin });
102113
this.config.logger.fatal(err, { origin });
103114
});

0 commit comments

Comments
 (0)