Re: [whatwg/streams] Handling stream errors in a TransformStream transformer (Issue #1212)

> I do find it a bit surprising that `abort()` is not called when a `WritableStream` throws from one of its underlying sink methods, or calls `controller.error()`.

We assume that `controller.error()` is only called from within the underlying sink itself, so it wouldn't be useful to have `error()` call *yet another* sink method.

Similarly, we assume that errors thrown (or promises rejected) from within a sink method were already handled by that sink method (e.g. with a `try..catch`).

`abort()` is reserved for an error that was injected *outside* of the sink, i.e. by the writer.

---

That said, I do agree with the OP: cancelling the readable end and/or aborting the writable end of a transform stream *should* call some sort of `finally()` or `close()` method on the underlying transformer, so it can clean up any held resources. 👍

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1212#issuecomment-1020639112

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/issues/1212/1020639112@github.com>

Received on Monday, 24 January 2022 23:06:52 UTC