throwbeginnerfunction* gen() {
try { yield 1 }
catch (e) { console.log(e.message) } // β 'oops'
}
const it = gen()
it.next()
it.throw(new Error('oops'))generator.throw() resumes the generator by throwing an error at the yield point, which can be caught inside the generator.
Check that throw() with string throws.