chore: Improve error page (#66)

* chore: Improve error page

* fix: Fix middlware order

* fix: Remove console.log
This commit is contained in:
Khaled Garbaya
2017-11-15 14:01:54 +01:00
committed by GitHub
parent 3a78027c28
commit f45c65c111
6 changed files with 54 additions and 37 deletions

View File

@@ -7,6 +7,9 @@
module.exports.catchErrors = (fn) => {
return function (request, response, next) {
return fn(request, response, next).catch((e) => {
if (e.response) {
e.status = e.response.status
}
next(e)
})
}