async function stack trace after await

36 views
Skip to first unread message

Boris Okunskiy

unread,
Jan 24, 2017, 11:03:36 AM1/24/17
to v8-users
Stack traces from async functions are different before and after await:

main();

async function main() {
    console.log('stack #1', new Error().stack);
    await one();
    console.log('stack #2', new Error().stack);
}

async function one() {
    // noop
}

In this example stack #1 contains call site (line 1), but stack #2 does not.

Reproducible in Chrome 55.0.2883.95 and Node 7.4.0

Yang Guo

unread,
Feb 8, 2017, 3:08:43 AM2/8/17
to v8-users
This is working as intended. The stack trace after await is missing because the async function is being resumed from the microtask queue.
Reply all
Reply to author
Forward
0 new messages