Nice article, there needs to be more about promises because their error handling is a bit finnicky.
Always add a .catch(), because promises will swallow your errors without any second thought.
Also, remember to re-throw your error inside the .catch() handler if you only handle a specific type of error, because the other error types will also end up there and be swallowed as well.
Are you sure that you always need to add a .catch()? As long as an error is thrown, and you don't swallow the error yourself inside of your own .catch(), then it should keep bubbling up until it reaches an error handler. I could be wrong but this is the behavior I'm used to seeing with async/await.
I think you're right.
But if you deep down it can always be the case that there is a catch somewhere above that eats errors.
Agree, it's generally a good idea to be explicit and prevent any edge cases.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.