mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-11-25 18:52:20 -05:00
Added custom error handler
This commit is contained in:
parent
f8c9d99107
commit
b02878d41d
18
server.js
18
server.js
@ -82,6 +82,24 @@ app.get('/manifest.cache', function (req, res) {
|
|||||||
app.get('*', clientApp.html());
|
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({
|
//https.createServer({
|
||||||
// key: fs.readFileSync(config.http.key),
|
// key: fs.readFileSync(config.http.key),
|
||||||
// cert: fs.readFileSync(config.http.cert)
|
// cert: fs.readFileSync(config.http.cert)
|
||||||
|
Loading…
Reference in New Issue
Block a user