-
Notifications
You must be signed in to change notification settings - Fork 37
Calling return or throw on paused async generator #5
Comments
If the answer is yes, then that means that we cannot queue continuation requests for next, throw, and return. We would instead have to reject any attempt to resume the generator when there is a current request in flight. |
I think the answer must be no, at least for "throw". If we have: try { await somethingAsync() }
catch (x) { } Then we must be able to assume that That leaves "return"... |
I agree the answer should be no in both cases. I think both next() and throw() should return promises that are pending forever, to signal that they never get a chance to execute. |
@domenic in light of #126 I don't get this. I don't see anything in the spec for To me it would be more reasonable if we add a clarification to the async iterator protocol that pending promises from |
Consider:
What should happen in this case? The generator is waiting infinitely on a never-resolved promise. Should "return" and "throw" resume the generator even though it is paused on an await? It seems like it should.
The text was updated successfully, but these errors were encountered: