Re: [whatwg/streams] `.throw()`ing an async iterator (Issue #1284)

I guess this would require a whole new error channel in streams. One where the error could be caught and dismissed.

```js
const generator = readUsers()
const stream = new ReadableStream({
  async catch (error, controller) {
    // generator throws in typical case, erroring the stream
    const result = await generator.throw(error)
    // generator catch block returned, close the stream
    if (result.done) await controller.close()
    // generator handled the error and resumed, keep the stream open
    else return
  }
})
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1284#issuecomment-1599503949
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/issues/1284/1599503949@github.com>

Received on Tuesday, 20 June 2023 21:05:30 UTC