Error handling in JavaScript (ES6) generators

Max Stoiber
InstructorMax Stoiber

Share this video with your friends

Send Tweet

One can throw an error in a generator from the outside with it.throw(). Since all the code inside of a generator is synchronous, we can use the standard try/catch method of handling errors!

iamdi
iamdi
~ 2 years ago

Probably, passing an Error instance will be a better example than a string.