Try/Catch always needed for await?

Jordan Rome jordan at jordanrome.com
Sat Oct 15 18:09:12 UTC 2016


On Fri, Oct 14, 2016 at 11:25 AM, Alan Johnson <alan at breakrs.com> wrote:

> Having unexpected errors be silently swallowed is definitely a problematic
> property of promises, which you have to guard against.


I didn't think this was the case with await. If a promise rejection is not
caught the await throws an exception and doesn't execute code below in the
async function. Also, I believe Node is soon adding support for killing the
process if a rejected Promise is not caught before it's garbage collected.
If this is true why the importance of using try/catch with await, don't we
want programmer errors to be noisy so we can fix them?

-- 
Best,

Jordan Rome
www.jordanrome.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161015/1a28b333/attachment.html>


More information about the es-discuss mailing list