Hint
Throwing inside an async function rejects its returned Promise. try/catch around await catches rejected Promises just like sync exceptions.
async function failing() {
throw new Error('oops');
}
async function main() {
console.log('A');
try {
await failing();
console.log('B');
} catch(e) {
console.log('C:', e.message);
}
console.log('D');
}
main();
console.log('E');A E C: oops D
Explanation: "A" β sync. await failing() suspends main. "E" β sync resumes. Microtask: failing() rejected β caught β "C: oops". After catch, continues: "D". "B" is skipped β throw jumps to catch.
Key Insight: Throwing inside an async function rejects its returned Promise. try/catch around await catches rejected Promises just like sync exceptions.