From 72ac0866d9ddccae43de8d5a19e8a9a01b131e9f Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Tue, 20 Mar 2018 22:35:36 +0100 Subject: Refactor error handling code --- src/server/routes/getSchedule.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/server/routes') diff --git a/src/server/routes/getSchedule.js b/src/server/routes/getSchedule.js index f1120b7..04df28a 100644 --- a/src/server/routes/getSchedule.js +++ b/src/server/routes/getSchedule.js @@ -69,6 +69,10 @@ router.get('/:type/:value', (req, res, next) => { res.status(response.status).end(response.data); }) .catch((err) => { + if (err.response) { + // eslint-disable-next-line no-param-reassign + err.status = err.response.status; + } next(err); }); }); -- cgit v1.1