DEV Community

Discussion on: About async functions

Collapse
 
tkdodo profile image
Dominik D

The next example replaces throw with Promise.reject, both in non-async functions on purpose. The takeaway is that throw is only consistently transformed to failed promises in async functions, which is a detail that is easy to miss. Promise.reject is more explicit and works everywhere.

Collapse
 
jcubic profile image
Jakub T. Jankiewicz

That's right, sorry didn't nice that. I was looking at missing async keyword. Good article.