From 2300219016690e28bd93332b6e385fe3481daa79 Mon Sep 17 00:00:00 2001 From: Katharina Irrgang Date: Mon, 24 Apr 2017 19:46:10 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=20optimise=20error=20handling?= =?UTF-8?q?=20(#8378)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue - if you start Ghost and you theme is invalid, you only get a warning, but no reason - furthermore, if any error is thrown in Ghost, which is not a custom Ignition error, we take care that the error message to inherit from shows up --- core/server/middleware/error-handler.js | 1 + core/server/themes/index.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/server/middleware/error-handler.js b/core/server/middleware/error-handler.js index d931e5519d..8fc16450d0 100644 --- a/core/server/middleware/error-handler.js +++ b/core/server/middleware/error-handler.js @@ -80,6 +80,7 @@ _private.prepareError = function prepareError(err, req, res, next) { } else { err = new errors.GhostError({ err: err, + message: err.message, statusCode: err.statusCode }); } diff --git a/core/server/themes/index.js b/core/server/themes/index.js index 03ae15a35b..f4508e449b 100644 --- a/core/server/themes/index.js +++ b/core/server/themes/index.js @@ -39,9 +39,12 @@ module.exports = { debug('Activating theme (method A on boot)', activeThemeName); self.activate(theme, checkedTheme); }) - .catch(function () { + .catch(function (err) { // Active theme is not valid, we don't want to exit because the admin panel will still work - logging.warn(i18n.t('errors.middleware.themehandler.invalidTheme', {theme: activeThemeName})); + logging.error(new errors.InternalServerError({ + message: i18n.t('errors.middleware.themehandler.invalidTheme', {theme: activeThemeName}), + err: err + })); }); }) .catch(function () {