1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-22 09:12:19 -05:00

Added custom error handler

This commit is contained in:
Carlos Brito Lage 2013-10-20 15:00:51 -07:00
parent f8c9d99107
commit b02878d41d

View File

@ -82,6 +82,24 @@ app.get('/manifest.cache', function (req, res) {
app.get('*', clientApp.html());
app.use(function handleError(err, req, res, next) {
var errorResult = {message: 'something bad happened'};
if (config.isDev) {
if (err instanceof Error) {
if (err.message) {
errorResult.message = err.message;
}
if (err.stack) {
errorResult.stack = err.stack;
}
}
}
return res.send(500, errorResult);
});
//https.createServer({
// key: fs.readFileSync(config.http.key),
// cert: fs.readFileSync(config.http.cert)