From 49b4ae1a6e0c17ea8e50306f4fef9c97d1b3c0cd Mon Sep 17 00:00:00 2001 From: jomo Date: Sun, 16 Aug 2015 06:17:38 +0200 Subject: [PATCH] exit on process error From the iojs docs: > An unhandled exception means your application - and by extension io.js itself - > is in an undefined state. Blindly resuming means anything could happen. > > Think of resuming as pulling the power cord when you are upgrading your system. > Nine out of ten times nothing happens - but the 10th time, your system is bust. > > uncaughtException should be used to perform synchronous cleanup before shutting > down the process. It is not safe to resume normal operation after > uncaughtException. If you do use it, restart your application after every > unhandled exception! --- www.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www.js b/www.js index 981c14b..0b649ff 100644 --- a/www.js +++ b/www.js @@ -3,8 +3,9 @@ var cleaner = require("./lib/cleaner"); var config = require("./config"); var cluster = require("cluster"); -process.on("uncaughtException", function (err) { +process.on("uncaughtException", function(err) { logging.error("uncaughtException", err.stack || err.toString()); + process.exit(1); }); if (cluster.isMaster) {