app.get('/', function (req, res, next) {
Promise.resolve().then(function () {
throw new Error('BROKEN')
}).catch(next) // Errors will be passed to Express.
})
app.use(( err, req, res, next ) => {
res.locals.error = err;
if (err.status >= 100 && err.status < 600)
res.status(err.status);
else
res.status(500);
res.render('error');
});
process.on('warning', veri => console.log(veri))
process.on('unhandledRejection', veri => console.log(veri))
process.on('uncaughtException', veri => console.log(veri))