Skip to content

Instantly share code, notes, and snippets.

@tdubs42
Last active September 8, 2021 21:15
Show Gist options
  • Save tdubs42/c852b7dbbc0b09b77d436f7665559826 to your computer and use it in GitHub Desktop.
Save tdubs42/c852b7dbbc0b09b77d436f7665559826 to your computer and use it in GitHub Desktop.
use in express server to feed errors down the pipeline via .catch(next) || next({status: CODE, message: MESSAGE})
/* eslint-disable */
router.use((err, req, res, next) => {
res.status(err.status || 500).json({
fromTheDev: 'mistakes were made',
message: err.message,
stack: err.stack,
})
})
/* eslint-enable */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment