diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-06-18 21:46:32 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-06-18 21:46:32 +0200 |
commit | e92239cec7151cbd3bf1b025375fae70505fe6be (patch) | |
tree | 017faa36503c4398e45b92de26e2a366aecc40e8 | |
parent | 569e5b05c483a152827faaeb54136fa2da7ede8e (diff) |
Also log error itself upon global error catch
-rwxr-xr-x | webserver.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/webserver.js b/webserver.js index aecca12..5ebdc41 100755 --- a/webserver.js +++ b/webserver.js @@ -199,8 +199,9 @@ app.get("/goioi", function (req, res) { // Error-handling middleware app.use(function (err, req, res, next) { const id = new Date().getTime().toString() + Math.random().toFixed(10).slice(2); - console.log("Error caught in app: (id=" + id + ")"); - console.log(err.stack); + console.error("Error caught in app: (id=" + id + ")"); + console.error(err); + console.error(err.stack); res.status(500).end("An internal error occurred; it has been logged with id " + id + ".\n"); }); |