mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
nodejitsu: adding lib/ (removing from .gitignore so nodejitsu doesn't
have to run make, since I can't figure out how to do that anyway)
This commit is contained in:
27
lib/server/serverError.js
Normal file
27
lib/server/serverError.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// 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);
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user