Skip to content

Instantly share code, notes, and snippets.

@bathos
Created December 1, 2019 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bathos/b59b1c484b50856351550e792b5f5a39 to your computer and use it in GitHub Desktop.
Save bathos/b59b1c484b50856351550e792b5f5a39 to your computer and use it in GitHub Desktop.
throwing-into-iterated-async-gen.js
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