Try/Catch always needed for await?

Jordan Rome jordan at
Fri Oct 14 13:10:21 UTC 2016

My apologies if this has already been discussed but what is the "preferred"
pattern for using await ? Since await, which runs on promises, will now
throw if the promise is rejected (preventing execution of code after the
await and killing the process in Node), is it neccesary to always be
wrapping await in try/catch?

I don't wrap all my sync code (even when calling functions in an external
dependency) in try/catch yet a lot of posts/articles I've seen written
about await is that you should always wrap it in a try/catch. Is this
because there is a lot of mis-use of reject, which, AFAIK, is supposed to
contain an Error and is the async equivalent of throwing? Or maybe because
you just don't know the source and length of the promise chain and
therefore it's dangerous?


Jordan Rome
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list