DEV Community

Discussion on: 7 Reasons Why JavaScript Async/Await Is Better Than Plain Promises (Tutorial)

Collapse
 
davidmaxwaterman profile image
Max Waterman

You can’t set breakpoints in arrow functions that return expressions (no body).

Works fine in chrome dev tools.

I like a lot about await, but I don't like having to use try/catch - it's not a construct I'm used to...it forces me to use 'let' instead of 'const' if I want to have access outside the catch block. Also, it indents one more level. Perhaps I need to learn try/catch more, but I note your examples tend not to show error handling, except the one where it is claimed as an advantage.

Collapse
 
gafi profile image
Mostafa Gaafar

I share your dislike of try/catch, but it's the only way to handle errors in synchronous code, so we don't really have a choice. Async/await enables us to use just 1 approach to handle both sync & async errors. I'd prefer to handle all errors in the same way, even if it's not my favorite way 🤷‍♀️

Collapse
 
davidmaxwaterman profile image
Max Waterman

I also don't really like the aspect that it hides what is going on. It looks synchronous, but definitely isn't.
Then there's the kangaroo behaviour when stepping through it, which isn't expected from its "sequential" appearance.
Imo, it's trying to be "too clever".
... having said that, I still find myself using it.