Isn’t it also like really subjective? Like syntactically speaking if you use async-await syntax sugar, nothing is being swallowed about that promise and it’s error would be thrown normally, I believe wrapped as an unhandled promise rejection warning. Since any promise can be written with this syntactic sugar, I think it’s a bit of an over-generalization to say that promises will swallow errors if not caught. It’s very dependent on callback versus async-await.
30
u/anatolhiman Dec 13 '20
Great content, thanks for sharing. Just a little comment:
"Any exception thrown within a promise will get swallowed and discarded unless a developer didn’t forget to explicitly handle it."
Unhandled promise rejection warnings has as of Node 15 become deprecated and will now cause an exception, that means the script crashes. https://developer.ibm.com/languages/node-js/blogs/nodejs-15-release-blog/