Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Commit

Permalink
Wrap @param handler in try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
kylealwyn committed Jan 15, 2018
1 parent 0d24f88 commit 562891d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ module.exports.controller = (basepath, middleware = []) => {

if (target.__params) {
target.__params.forEach(({ id, handler }) => {
router.param(id, handler);
router.param(id, (req, res, next, ...rest) => {
Promise.resolve(handler.call(target, req, res, next, ...rest)).catch(next);
});
});
}

Expand Down

0 comments on commit 562891d

Please sign in to comment.