Unlike other middleware functions error-handling middleware functions have four arguments instead of three: (err, req, res, next)
.
Sample:
app.use(function(err, req, res, next) {
console.error(err.stack);
res.status(500).send('Error found!');
});