1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-15 17:18:05 -05:00
shimapan/app/util/wrap.js

5 lines
180 B
JavaScript
Raw Normal View History

// Wraps an async middleware function to catch promise rejection
2018-07-26 21:52:47 -04:00
const wrap = fn =>
(req, res, next) => Promise.resolve(fn(req, res, next)).catch(next);
module.exports = wrap;