bluebird: second argument for .tap or similar method for rejections
I often use .tap(console.log) for quick debugging. It would be useful for me to have it either work like .then so I could do .tap(null, console.log) as well to log rejections.
Or to have a similar method that works like .tap but is analog to .catch as in .tapRejection(console.log).
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 31 (7 by maintainers)
FYI https://github.com/petkaantonov/bluebird/pull/1220
I’ve also got a legitimate production usecase: maintaining the lifecycle of a transaction for running sql queries.
Currently I have to do this:
I would prefer to do this:
Of course, a
tapErrorfunction would be even better.You said you get 100+ exceptions / second, that only makes sense if it’s production.
@spion to be fair that same argument can be made for
tap:.then(log)So if I’m getting this right: you are editing code in production to add a quick console.log, instead of logging all exceptions automatically and just grepping your function name from them? And you want bluebird to endorse this practice by adding a feature into the core which makes an anti-pattern take 1 line instead of 3?