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?

-- 
Best,

Jordan Rome
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to