Closed apmeena closed 7 years ago
I am using Express js (version 4.13.4), so in app.js
file I changed the code :
app.use(function(err, req, res, next) {
res.status(err.errorCode || err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});
to
app.use(function(err, req, res, next) {
res.status(err.errorCode || err.status || 500).send({status:'fail', data:err.message});
});
Now it works perfectly.
I am using node_acl, it is working fine but whenever any request get denied it generates 500 Internal Server Error but it should show 403 Access denied error.