aboutsummaryrefslogtreecommitdiff
path: root/src/server/routes
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-03-20 22:35:36 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-03-20 22:35:36 +0100
commit72ac0866d9ddccae43de8d5a19e8a9a01b131e9f (patch)
tree641ff370e8dd066253d71af9b0c3f58562cedb9a /src/server/routes
parent29f7292f84d456a49dd8e2dcd93ab2395470aef0 (diff)
Refactor error handling code
Diffstat (limited to 'src/server/routes')
-rw-r--r--src/server/routes/getSchedule.js4
1 files changed, 4 insertions, 0 deletions
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);
});
});