feat(Errors): Add global error handling

This commit is contained in:
Khaled Garbaya
2017-10-05 10:37:09 +02:00
committed by Benedikt Rötsch
parent 17b52868e2
commit 64f59e203d
4 changed files with 37 additions and 18 deletions

View File

@@ -7,6 +7,8 @@
exports.catchErrors = (fn) => {
return function (req, res, next) {
return fn(req, res, next).catch(next)
return fn(req, res, next).catch((e) => {
next(e)
})
}
}