Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Calling return or throw on paused async generator #5

Closed
@zenparsing

Description

@zenparsing

Consider:

async function* agf() {
    try { await new Promise(_=> null) }
    catch (x) { print("caught error") }
    finally { print("finally!") }
}

var ag = agf();
ag.next();
ag.return();

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions