-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to send different error response from error handler middleware #2372
base: develop
Are you sure you want to change the base?
Conversation
d066364
to
bfac84b
Compare
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_next
why this change ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a good practise to prefix the variable with underscore when it is unused in the function but required in function parameter. It also prevents warning.
Considering it, I have added _ before next middleware.
bfac84b
to
d892ed0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Date: 26 Jan, 2025
Developer Name: @pankajjs
Issue Ticket Number
Description
This PR fixes the error handler middleware by adding support to send different error responses based on error types.
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes