Add 500 error support
This commit is contained in:
parent
6e66b84cdd
commit
af378b0f50
2 changed files with 10 additions and 0 deletions
5
app.js
5
app.js
|
@ -103,5 +103,10 @@ app.use(morgan("dev"))
|
|||
res.status(404);
|
||||
res.render("404", {url: req.path});
|
||||
})
|
||||
.use((err, req, res, next) => {
|
||||
console.error(err.stack);
|
||||
res.status(500);
|
||||
res.render("error");
|
||||
})
|
||||
.listen(8080);
|
||||
|
||||
|
|
5
views/error.pug
Normal file
5
views/error.pug
Normal file
|
@ -0,0 +1,5 @@
|
|||
extend layout
|
||||
block content
|
||||
h1 500 - Internal error
|
||||
p Sorry an unexpected error occurred internally
|
||||
|
Loading…
Reference in a new issue