[whatwg/streams] Should the abort result reflect the close result? (Issue #1203)

Let's think about the following code.

```js
const e = Error();
const ws = new WritableStream({close() { return Promise.reject(e); }});
const writer = ws.getWriter();
writer.close();
await writer.abort();
```

This throws an exception because https://streams.spec.whatwg.org/#writable-stream-finish-in-flight-close-with-error rejects the promise. I want to understand the reason behind this - why is it bad to just fulfill the promise returned by `abort()`, given `close()` returns its own promise?

Note that the following code doesn't throw.

```js
const e = Error();
const ws = new WritableStream({close() { return Promise.reject(e); }});
const writer = ws.getWriter();
await writer.close().catch(() => {});
await writer.abort();
```

cc: @nidhijaju 


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

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

Received on Thursday, 6 January 2022 07:50:10 UTC