Created
December 1, 2019 21:36
-
-
Save bathos/b59b1c484b50856351550e792b5f5a39 to your computer and use it in GitHub Desktop.
throwing-into-iterated-async-gen.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void async function() { | |
const asyncGenerator = async function *() { try { yield; } catch {} }(); | |
try { | |
for await (const value of asyncGenerator) { | |
await asyncGenerator.throw(new Error); | |
} | |
console.log('caught'); | |
} catch { | |
console.log('not caught'); | |
} | |
}(); | |
// Firefox "caught" | |
// Safari "caught" | |
// Chrome "not caught" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment