Skip to content

Commit

Permalink
Removed Bluebird catch predicate
Browse files Browse the repository at this point in the history
- We use bluebird inconsistently throughout the codebase now
- The original reason why we needed to use it so heavily was so that all promises returned had the bluebird behaviour, including catch predicates
- Most other usage is explicit, but this is really hard to detect and hasn't made it to standard promises, so we should get rid of this pattern
  • Loading branch information
ErisDS committed Jul 7, 2021
1 parent 09283bd commit 10aad8d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions core/server/services/themes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ module.exports = {
}
});
})
.catch(errors.NotFoundError, function (err) {
// CASE: active theme is missing, we don't want to exit because the admin panel will still work
err.message = i18n.t('errors.middleware.themehandler.missingTheme', {theme: activeThemeName});
logging.error(err);
})
.catch(function (err) {
// CASE: theme threw an odd error, we don't want to exit because the admin panel will still work
// This is the absolute catch-all, at this point, we do not know what went wrong!
logging.error(err);
if (err instanceof errors.NotFoundError) {
// CASE: active theme is missing, we don't want to exit because the admin panel will still work
err.message = i18n.t('errors.middleware.themehandler.missingTheme', {theme: activeThemeName});
logging.error(err);
} else {
// CASE: theme threw an odd error, we don't want to exit because the admin panel will still work
// This is the absolute catch-all, at this point, we do not know what went wrong!
logging.error(err);
}
});
},
getJSON: require('./to-json'),
Expand Down

0 comments on commit 10aad8d

Please sign in to comment.