complete-node-bootcamp icon indicating copy to clipboard operation
complete-node-bootcamp copied to clipboard

app.use(globalErrorHandler)

Open trimi-cyber opened this issue 3 years ago • 2 comments

is not working

trimi-cyber avatar Mar 24 '22 13:03 trimi-cyber

@trimi-cyber in errorController.js file do the following changes...

module.exports = (err, req, res) change this to module.exports = (err, req, res, next)

sendErrorDev(err, req, res) to sendErrorDev(err, req, res, next)

sendErrorProd(error, req, res) to sendErrorProd(error, req, res, next)

and dont forgot to call next() method in both sendErrorDev and sendErrorProd hope this will help

subha1206 avatar Apr 17 '22 11:04 subha1206

If you're following "Handling Duplicate Database Fields", you can fix by doing:

image