4 ms·
Correct me if I'm wrong, but I think you can avoid this by doing: thingToUseLater.catch(() => {}) And just ignoring the result of .catch(). Promises are reusa
by slaymaker1907 5y ago
Correct me if I'm wrong, but I think you can avoid this by doing:
thingToUseLater.catch(() => {})
And just ignoring the result of .catch(). Promises are reusable so thingToUseLater can be waited on later when you want to block for it.
Thanks for thoughts on this. I use promises a lot but this is an edge case I hadn't thought about. They are really pretty handy for build scripts since they make your dependencies explicit.
- beardedetim 5y agoYup. If you call catch, you've handled the promise. You would need to throw from within the callback in order for the promise itself to reject after that.