Re:Never Mix Promises and Callbacks in NodeJS
by spankalee on Friday April 07, 2017 @12:38PM
(#14061206)
It is worth it though because of the much better error handling in Promises and the ability to use async/await which makes error handling even more easy to get correct.
I'd suggest making all functions that take callbacks also return Promises to make the transition easier:
I'd suggest making all functions that take callbacks also return Promises to make the transition easier:
You can put this in a utility (and I'd recommend standardizing on Node's callback style): At some point you can start warning when callbacks are passed in, then throwing, then remove the argument.