I need a very simple pattern for a catch-all of async/Promise errors; the normal pattern of:
app.use(function (err, req, res, next) {
...
});
does not handle async errors, and I can't find any working pattern anywhere.
What I did find is very limited:
process.on('unhandledRejection', function (err, p) {
...
});
It's limited because I don't have a req
object to do some logging/retrospection with, and I don't have a res
object to shape my response.
What might be a working pattern for a catch-all that catches async/Promise exceptions?