update error handling
This commit is contained in:
parent
c2bb32dcf2
commit
1c84982232
2 changed files with 2 additions and 2 deletions
2
index.js
2
index.js
|
@ -514,12 +514,14 @@ app.use(function(req, res, next) {
|
|||
res.status(404).render(dir + "errors/404.ejs");
|
||||
});
|
||||
app.use(function(error, req, res, next) {
|
||||
console.log(error);
|
||||
res.status(500).render(dir + "errors/500.ejs", { error });
|
||||
});
|
||||
app.listen(port, () => {
|
||||
console.log(`Server started on port ${port}`);
|
||||
});
|
||||
app.on("error", error => {
|
||||
console.log(error)
|
||||
if (error.syscall !== "listen") {
|
||||
throw error;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue