@ladjs/graceful
Advanced tools
Comparing version 4.1.0 to 4.2.0
15
index.js
@@ -100,14 +100,5 @@ const http = require('node:http'); | ||
// handle uncaught exceptions | ||
process.once('uncaughtException', (err) => { | ||
// always log to console the error (e.g. so we can see it on pm2 logs) | ||
console.error(err); | ||
if (this.config.hideMeta) | ||
this.config.logger.error(err, { [this.config.hideMeta]: true }); | ||
else this.config.logger.error(err); | ||
// artificial timeout to allow logger to store uncaught exception to db | ||
if (this.config.uncaughtExceptionTimeoutMs) | ||
setTimeout(() => { | ||
process.exit(1); | ||
}, this.config.uncaughtExceptionTimeoutMs); | ||
else process.exit(1); | ||
process.on('uncaughtExceptionMonitor', (err, origin) => { | ||
console.error(err, { origin }); | ||
this.config.logger.fatal(err, { origin }); | ||
}); | ||
@@ -114,0 +105,0 @@ |
{ | ||
"name": "@ladjs/graceful", | ||
"description": "Gracefully exit HTTP servers (Express/Koa/Fastify/etc), databases (Mongo/Mongoose), Bree job schedulers, and custom handlers.", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)", | ||
@@ -6,0 +6,0 @@ "bugs": { |
26689
308