| botched the error page, fixing - seedlinux - Torrent indexing tool opensource t… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 28df4acf7236cde8496692e40b9d92fe1a672628 | |
| parent 00413fe035e7c2970a574b46f818282724ca62c4 | |
| Author: Jay Scott <[email protected]> | |
| Date: Sat, 1 Jul 2017 12:03:17 +0100 | |
| botched the error page, fixing | |
| Diffstat: | |
| M app.js | 5 ++++- | |
| M views/error.pug | 2 +- | |
| 2 files changed, 5 insertions(+), 2 deletions(-) | |
| --- | |
| diff --git a/app.js b/app.js | |
| @@ -38,13 +38,16 @@ app.use('/', index); | |
| app.use('/torrent/', torrent); | |
| app.use(function(req, res, next) { | |
| - res.status(404).render('error'); | |
| + var err = new Error('Not Found'); | |
| + err.status = 404; | |
| + next(err); | |
| }); | |
| app.use(function(err, req, res, next) { | |
| res.locals.message = err.message; | |
| res.locals.error = req.app.get('env') === 'development' ? err : {}; | |
| + | |
| res.status(err.status || 500); | |
| res.render('error'); | |
| }); | |
| diff --git a/views/error.pug b/views/error.pug | |
| @@ -12,4 +12,4 @@ html | |
| h2.ui.center.aligned.icon.header | |
| i.frown.icon | |
| .content | |
| - .sub.header= "Whoops! I think you are lost!" | |
| + .sub.header= "Whoops! I think you are lost! (" + error.status + ")" |