-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.js
More file actions
24 lines (23 loc) · 746 Bytes
/
errors.js
File metadata and controls
24 lines (23 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var NotFound = require('./NotFound');
var setupErrorHandlers = function(server) {
server.use(function(err, req, res, next){
if (err instanceof NotFound) {
res.status(404);
res.render('404.jade', {
title : '404 - Not Found'
,description: err.toString()
,author: ''
});
} else {
GLOBAL.logger.error(err);
res.status(500);
res.render('500.jade', {
title : '500 - The Server Encountered an Error'
,description: err.toString()
,author: ''
,error: err
});
}
});
};
module.exports = {setupErrorHandlers: setupErrorHandlers};