async/await improvements

Tab Atkins Jr. jackalmage at
Wed Nov 12 16:14:10 PST 2014

On Wed, Nov 12, 2014 at 4:07 PM, James Long <longster at> wrote:
> Maybe this would be resolved if you could answer this: how do you mark
> an async function to be a top-level one? I don't see anywhere that
> says "I don't return a promise, I want errors inside of me to
> literally throw. I am an all-powerful top-level consumer of async
> stuff"). Seems like that would need extra syntax?

There is currently no way to do so.  If there was, they still wouldn't
"literally throw", because again, that's impossible - by the time the
promise rejects, it may be another turn entirely, and the program
counter is long past the callsite.  The best it can do is be an
automatically-unhandled error, caught by window.onerror.


More information about the es-discuss mailing list