Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

AsyncGenerator.prototype.throw()

2 tags 1 category

The throw() method of AsyncGenerator instances acts as if a throw statement is inserted in the generator’s body at the current suspended position, which informs the generator of an error condition and allows it to handle the error, or perform cleanup and close itself.

Return value: If the thrown error is not caught, it will return a Promise which rejects with the exception passed in.

Return value: If the exception is caught by a try…catch and the generator resumes to yield more values, it will return a Promise which resolves with an Object with two properties:

Return value: done A boolean value: true if the generator function’s control flow has reached the end. false if the generator function is able to produce more values. value The value yielded from the next yield expression.

Syntax example: asyncGeneratorInstance.throw(exception)

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…