Try/Catch always needed for await?
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss