On Sat, Oct 15, 2016 at 11:40 PM, Jordan Harband <ljh...@gmail.com> wrote:
> When the await throws an exception that's not caught by a try/catch, the
> promise returned by the `async function` ends up rejected - and you have
> the identical scenario as a promise with an unhandled rejection.
Ah, that's the part I was missing and that 'await' is not allowed at the
top level (for now). Thanks!
I think then my question really depends on the implementation of unhandled
rejections? I see a lot of example code where 'catch' simply calls
console.error (and/or logs an error to a backend). In chrome you get the
'Uncaught (in promise)' message in the console. I'm still confused as to
why it's important to always try/catch (or even catch for promises) if you
get an error message in the console (vs calling console.error manually). Do
some engines still silently swallow these errors without any kind of notice?
es-discuss mailing list