fix(backend/app.js): fix internal error handler

This commit is contained in:
dec0dOS 2022-10-09 16:12:27 +01:00
parent 7b51fbc8c6
commit 15e4051625

View file

@ -87,8 +87,8 @@ app.use("/controller", routerController); // other controller-specific routes
app.get("*", async function (req, res) { app.get("*", async function (req, res) {
res.status(404).json({ error: "404 Not found" }); res.status(404).json({ error: "404 Not found" });
}); });
app.use(async function (err, req, res) { app.use(function (err, req, res, next) {
console.error(err.stack); // TODO: replace with production logger console.error(err.stack);
res.status(500).json({ error: "500 Internal server error" }); res.status(500).json({ error: "500 Internal server error" });
}); });