From a7812ee30d27356228187fbe3175d7a940d0a458 Mon Sep 17 00:00:00 2001 From: Pankaj Date: Fri, 7 Feb 2025 15:08:02 +0530 Subject: [PATCH] fix: add support to send different error response (#2372) --- app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 52d8be9e2..383086921 100644 --- a/app.js +++ b/app.js @@ -23,12 +23,13 @@ app.use(function (req, res, next) { }); // error handler -app.use(function (err, req, res, next) { +app.use(function (err, req, res, _next) { if (isMulterError(err)) { - multerErrorHandling(err, req, res); - } else { - res.boom.notFound(err); + return multerErrorHandling(err, req, res); } + return res.boom.boomify(err, { + statusCode: err.statusCode, + }); }); module.exports = app;