Interesting post. Personally, I prefer the try catch approach. I try to avoid the promise.then syntax since it can be hard to understand the execution flow.
I prefer a mix of both await and .then/.catch, since try-catch is usually outside of the promise chain, so you cannot pinpoint where the error happened unless you wrap every single promise in a try-catch-block, which breaks the reading flow:
Interesting post. Personally, I prefer the try catch approach. I try to avoid the
promise.thensyntax since it can be hard to understand the execution flow.I prefer a mix of both await and .then/.catch, since try-catch is usually outside of the promise chain, so you cannot pinpoint where the error happened unless you wrap every single promise in a try-catch-block, which breaks the reading flow:
Good point! Never thought about it.
You have a good point. Actually, depending on the context, each approach may offer distinct advantages.