mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02:00
🥅 refactor: Express App default Error Handling with ErrorController
(#8249)
This commit is contained in:
parent
4285d5841c
commit
458580ec87
5 changed files with 281 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue