Skip to content

Commit

Permalink
🎨 optimise error handling (#8378)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kirrg001 authored and kevinansfield committed Apr 24, 2017
1 parent e745198 commit 2300219
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/server/middleware/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand Down
7 changes: 5 additions & 2 deletions core/server/themes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 2300219

Please sign in to comment.