From 6ed562e27917a9913012aad3f681f66f47785d01 Mon Sep 17 00:00:00 2001 From: icedream Date: Fri, 16 Oct 2015 08:21:55 +0200 Subject: [PATCH] Try a synchronized shutdown when an uncaught exception occurs. --- app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.js b/app.js index 0d5b6c1..2451a8b 100644 --- a/app.js +++ b/app.js @@ -30,6 +30,11 @@ doShutdownAsync = function(cb) { }); }; +process.on("uncaughtException", function(err) { + log.fatal("Shutting down due to an uncaught exception!", err); + app.shutdownSync(); +}); + process.on("exit", function(e) { log.debug("Triggered exit", e); app.shutdownSync();