Skip to content

Commit

Permalink
fix: handle unhandled exception at handleErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed May 21, 2024
1 parent 9502335 commit 598c10c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/controllers/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ exports.handleErrors = async function handleErrors(err, req, res, next) { // esl
try {
if (data.cases.hasOwnProperty(err.code)) {
data.cases[err.code](err, req, res, defaultHandler);
} else if (err.message.startsWith('[[error:no-') && err.message !== '[[error:no-privileges]]') {
notFoundHandler();
} else if (err.message.startsWith('Failed to lookup view')) {
notBuiltHandler();
} else if (err.message) {
if (err.message.startsWith('[[error:no-') && err.message !== '[[error:no-privileges]]') {
notFoundHandler();
} else if (err.message.startsWith('Failed to lookup view')) {
notBuiltHandler();
}
} else {
await defaultHandler();
}
Expand Down

0 comments on commit 598c10c

Please sign in to comment.