coke
Version:
A full stack MVC framework that speeds up your web development.
17 lines (14 loc) • 384 B
JavaScript
module.exports = function err500( err, req, res, next ){
res.status( err.status || 500 );
res.result = err;
// respond with html page
if( req.accepts( 'html' )){
return res.render( 'error/500' );
}
// respond with json
if( req.accepts( 'json' )){
return res.end();
}
// default to plain-text. send()
res.type( 'txt' ).send( 'Internal Server Error' );
};