mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Add a timeout to mongoldb connections (#15258)
* Add option to set a socket timeout for mongodb requests * Handle mongodb timeouts better * add default to config
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
CustomError,
|
||||
BadRequest,
|
||||
InternalServerError,
|
||||
RequestTimeout,
|
||||
} from '../libs/errors';
|
||||
|
||||
export default function errorHandler (err, req, res, next) { // eslint-disable-line no-unused-vars
|
||||
@@ -46,6 +47,10 @@ export default function errorHandler (err, req, res, next) { // eslint-disable-l
|
||||
}));
|
||||
}
|
||||
|
||||
if (err.name === 'MongoNetworkTimeoutError') {
|
||||
responseErr = new RequestTimeout();
|
||||
}
|
||||
|
||||
// Handle Stripe Card errors errors (can be safely shown to the users)
|
||||
// https://stripe.com/docs/api/node#errors
|
||||
if (err.type === 'StripeCardError') {
|
||||
|
||||
Reference in New Issue
Block a user