From 31b693da1f1298da334d33a5ee37a22a2ed3e176 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sun, 11 May 2014 17:33:18 +0100 Subject: [PATCH] Add try-catch to startup - Should prevent Ghost from exiting without an error message --- core/index.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core/index.js b/core/index.js index 2893273033..aa0b8ceec5 100644 --- a/core/index.js +++ b/core/index.js @@ -17,13 +17,19 @@ function startGhost(options) { options = options || {}; bootstrap(options.config).then(function () { - var ghost = require('./server'); - return ghost(options.app).then(deferred.resolve).otherwise(function (e) { - // We don't return the rejected promise to stop - // the propogation of the rejection and just - // allow the user to manage what to do. + try { + var ghost = require('./server'); + return ghost(options.app) + .then(deferred.resolve) + .otherwise(function (e) { + // We don't return the rejected promise to stop + // the propogation of the rejection and just + // allow the user to manage what to do. + deferred.reject(e); + }); + } catch (e) { deferred.reject(e); - }); + } }); return deferred.promise;