Skip to content

Commit a7812ee

Browse files
authored
fix: add support to send different error response (#2372)
1 parent 41e2ce9 commit a7812ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ app.use(function (req, res, next) {
2323
});
2424

2525
// error handler
26-
app.use(function (err, req, res, next) {
26+
app.use(function (err, req, res, _next) {
2727
if (isMulterError(err)) {
28-
multerErrorHandling(err, req, res);
29-
} else {
30-
res.boom.notFound(err);
28+
return multerErrorHandling(err, req, res);
3129
}
30+
return res.boom.boomify(err, {
31+
statusCode: err.statusCode,
32+
});
3233
});
3334

3435
module.exports = app;

0 commit comments

Comments
 (0)