EU ๐ช๐บ | Art, Tech & Good Vibrations ๐คณ | Founder of แดแดแดแดสสแดแดก ๐ hellotomorrow.agency โข Just started working on a new endeavour ๐ usepoe.app โข Follow me on Twitter!
Location
Brussels, Belgium
Work
UX Engineer, Product Manager, sometimes Designer at Self
Yes,
catch
is much more elegant.Can you explain why there must be a try/catch block?
@Manuele J Sarfatti
In a classic promise you have:
If you switch to using await and you do:
but the promise fails (throws an exception), then you have yourself an unhandled exception, and the browser will most probably crash your app.
The equivalent of the classic promise is therefore:
PS: this is pseudo-code off the top of my head and most probably not working, it's just to give an idea