fix: handle unhandled exception at handleErrors

This commit is contained in:
Julian Lam
2024-05-21 12:39:27 -04:00
parent 95023355f8
commit 598c10c6a9

View File

@@ -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();
}