DEV Community

Discussion on: Re-writing then/catch to async/await

Collapse
 
thomasrosen profile image
Thomas Rosen

What about the error handling in the async/await example?
Would I need a try/catch block? Or is the error expected to bubble to the uppermost catch?

Collapse
 
gladyspascual profile image
Gladys Pascual

That's a good 'catch' 😎 I've added the try/catch on the async/await syntax there, thanks for highlighting 🙌🏽

Collapse
 
sebbdk profile image
Sebastian Vargr • Edited

Async functions are just syntactical-sugar for Promises last I checked, so yes you need a try/catch. :)