errorhandling

This commit is contained in:
Flummi 2018-02-20 07:09:42 +01:00
parent 33064030d6
commit 3b34234c2f
2 changed files with 6 additions and 1 deletions

View File

@ -27,4 +27,9 @@ app
.get("/:uuid", (req, res) => res.redirect(`/v/${req.params.uuid}/`)) .get("/:uuid", (req, res) => res.redirect(`/v/${req.params.uuid}/`))
.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).send("Something broke!");
})
.listen(cfg.websrv.port, () => console.log(`fpaste listening on port ${cfg.websrv.port}`)); .listen(cfg.websrv.port, () => console.log(`fpaste listening on port ${cfg.websrv.port}`));

View File

@ -47,5 +47,5 @@ export default express.Router()
desc: r.reply ? `Reply to <a href="/${r.reply}/" class="descID">/${r.reply}/</a>` : r.desc || "No description.", desc: r.reply ? `Reply to <a href="/${r.reply}/" class="descID">/${r.reply}/</a>` : r.desc || "No description.",
rows: paste.split(/\r?\n/).length rows: paste.split(/\r?\n/).length
}}); }});
}).catch(err => res.send("paste not found " + JSON.stringify(err))); }).catch(err => res.send("paste not found"));
}); });