From e479dcb1ab1610f02041057e0a6f814edd89d101 Mon Sep 17 00:00:00 2001 From: Marco Rucci Date: Sat, 14 Sep 2013 16:36:20 +0200 Subject: [PATCH] Exit with failure when an error occured while connecting to mongod. This avoids the exeption being caught and ignored, letting the process hang in an unusable state. --- lib/cube/server.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cube/server.js b/lib/cube/server.js index eabbf400..2189002c 100644 --- a/lib/cube/server.js +++ b/lib/cube/server.js @@ -143,7 +143,11 @@ module.exports = function(options) { // Connect to mongodb. util.log("starting mongodb client"); database.open(options, function (error, db) { - if (error) throw error; + if (error) { + util.log("mongo exception: " + error); + util.log(error.stack); + process.exit(1) + } server.register(db, endpoints); meta = require("./event").putter(db); util.log("starting http server on port " + options["http-port"]);