🥅 refactor: Express App default Error Handling with ErrorController (#8249)

This commit is contained in:
Sebastien Bruel 2025-07-05 00:51:46 +09:00 committed by Danny Avila
parent 4285d5841c
commit 458580ec87
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
5 changed files with 281 additions and 9 deletions

View file

@ -18,7 +18,6 @@ const message = 'Your account has been temporarily banned due to violations of o
* @function
* @param {Object} req - Express Request object.
* @param {Object} res - Express Response object.
* @param {String} errorMessage - Error message to be displayed in case of /api/ask or /api/edit request.
*
* @returns {Promise<Object>} - Returns a Promise which when resolved sends a response status of 403 with a specific message if request is not of api/ask or api/edit types. If it is, calls `denyRequest()` function.
*/
@ -135,6 +134,7 @@ const checkBan = async (req, res, next = () => {}) => {
return await banResponse(req, res);
} catch (error) {
logger.error('Error in checkBan middleware:', error);
return next(error);
}
};