Files
habitica/lib/server/serverError.js
T
Tyler Renelle 0f8b7d48bd nodejitsu: changes necessary to run on jitsu
nodejitsu: database credentials (reset this commit!) & remove derby-ui-boot, just use bootstrap
2012-07-09 18:41:40 -04:00

28 lines
669 B
JavaScript

// Generated by CoffeeScript 1.3.3
var derby, isProduction;
derby = require('derby');
isProduction = derby.util.isProduction;
module.exports = function(root) {
var staticPages;
staticPages = derby.createStatic(root);
return function(err, req, res, next) {
var message, status;
if (err == null) {
return next();
}
console.log(err.stack ? err.stack : err);
message = err.message || err.toString();
status = parseInt(message);
if (status === 404) {
return staticPages.render('404', res, {
url: req.url
}, 404);
} else {
return res.send((400 <= status && status < 600) ? status : 500);
}
};
};