From e6da87faa91622aeb322bfa4ce67ea41cc8102e7 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Fri, 23 Apr 2021 14:47:08 +1200 Subject: [PATCH] better error handling --- api/src/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api/src/index.js b/api/src/index.js index 21579b0..29f4c1c 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -59,6 +59,14 @@ const app = express(); app.use(body_parser.urlencoded({ extended: true })); app.use(body_parser.json()); + app.use(function (err, req, res, next) { + return res + .status(400) + .send({ + stack: err.stack + }) + }) + const validate = (req, res, next) => { const errors = validationResult(req);