With async/await you will be using try/catch to handle errors. I've covered that a bit more in my tutorial on using the Fetch API here: www.joshmorony.com/http-requests-in-stencil-js-with-the-fetch-api/
Hi! Actually, that madly deep nesting shown for `takePhoto` function is not mandatory, you could build nice and flat `.then` chain if you return async functions results (not just call) and use `.catch`. Anyway, thanks for the video, I'm a subscriber! :)
Josh thanks for the video. Personally I prefer the async / await syntax but I think anyone new to programming should learn the .then syntax first as I think it then makes moving to the async / await syntax easier to understand. But as you say there is nothing wrong with sticking to the .then syntax. I also didn’t know just adding ‘async’ to a function meant it returned a promise, that’s interesting to know.
Hi, thanks for the video.
Is there a 'catch' equivalent with await?
With async/await you will be using try/catch to handle errors. I've covered that a bit more in my tutorial on using the Fetch API here: www.joshmorony.com/http-requests-in-stencil-js-with-the-fetch-api/
@@JoshuaMorony Thanks!
Hi! Actually, that madly deep nesting shown for `takePhoto` function is not mandatory, you could build nice and flat `.then` chain if you return async functions results (not just call) and use `.catch`. Anyway, thanks for the video, I'm a subscriber! :)
Thanks for the video!!!!!
Josh thanks for the video. Personally I prefer the async / await syntax but I think anyone new to programming should learn the .then syntax first as I think it then makes moving to the async / await syntax easier to understand. But as you say there is nothing wrong with sticking to the .then syntax. I also didn’t know just adding ‘async’ to a function meant it returned a promise, that’s interesting to know.
Very handy video, thanks. Super clear.
Fantastic