mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-17 19:15:59 +08:00
moved database down message to the top of the if stack
This commit is contained in:
parent
ad250d7f5c
commit
f00bc98db8
1 changed files with 4 additions and 4 deletions
|
@ -15,12 +15,12 @@ async function errorHandlingMiddleware(error, req, res, _next) {
|
|||
uid: error.uid ?? req.ctx?.decodedToken?.uid,
|
||||
};
|
||||
|
||||
if (error instanceof MonkeyError) {
|
||||
monkeyResponse.message = error.message;
|
||||
monkeyResponse.status = error.status;
|
||||
} else if (/ECONNREFUSED.*27017/i.test(error.message)) {
|
||||
if (/ECONNREFUSED.*27017/i.test(error.message)) {
|
||||
monkeyResponse.message =
|
||||
"Could not connect to the database. It may be down.";
|
||||
} else if (error instanceof MonkeyError) {
|
||||
monkeyResponse.message = error.message;
|
||||
monkeyResponse.status = error.status;
|
||||
} else {
|
||||
monkeyResponse.message =
|
||||
"Oops! Our monkeys dropped their bananas. Please try again later.";
|
||||
|
|
Loading…
Add table
Reference in a new issue