Skip to content

Instantly share code, notes, and snippets.

@DiegoRBaquero
Created January 20, 2018 18:58
Show Gist options
  • Save DiegoRBaquero/e2a63442fae8a7d9d079d0bcfad559f1 to your computer and use it in GitHub Desktop.
Save DiegoRBaquero/e2a63442fae8a7d9d079d0bcfad559f1 to your computer and use it in GitHub Desktop.
express-debug-async-wrap
module.exports = debug =>
fn =>
(req, res, next) =>
fn(req, res, next)
.catch(e => {
e.status = e.status || 400
e.debug = debug
next(e)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment