Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function() {
var staticPages = derby.createStatic(path.dirname(path.dirname(__dirname)))
return function(err, req, res, next) {
if (err == null) return next()
console.log(err.stack ? err.stack : err)
// Customize error handling here
var message = err.message || err.toString()
var status = parseInt(message)
status = (status >= 400 && status < 600) ? status : 500
if (status === 403 || status === 404 || status === 500) {
staticPages.render('error', res, status.toString(), status)
} else {
res.send(status)
}