Re: [whatwg/streams] TransformStream cleanup using "Transformer.cancel" (PR #1283)

What about:

```js
const ts = new TransformStream({
  flush() { console.log("t.flush") },
  async cancel(reason) {
    console.log("t.cancel start with", reason);
    await delay(100);
    console.log("t.cancel end");
    throw "t.cancel error";
  },
});
console.log("ts constructed");
ts.writable.close()
  .then(() => console.log("ws.close fulfilled"))
  .catch((err) => console.log("ws.close rejected with", err));
ts.readable.cancel("rs.cancel error")
  .then(() => console.log("rs.cancel fulfilled"))
  .catch((err) => console.log("rs.cancel rejected with", err));
console.log("started rs.cancel and ws.close");
```

```
ts constructed
t.flush
started ws.close and rs.cancel
ws.close fulfilled
rs.cancel fulfilled
```

I'm trying to figure out if it's observable from the outside that the RS was closed through a cancellation rather than a "clean close" (ie is `"rs.cancel error"` exposed through a `reader.read()` promise rejection)?

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

Message ID: <whatwg/streams/pull/1283/c1587847723@github.com>

Received on Monday, 12 June 2023 18:20:50 UTC