- From: Yutaka Hirano <notifications@github.com>
- Date: Fri, 04 Jun 2021 08:41:46 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 4 June 2021 15:42:54 UTC
@yutakahirano commented on this pull request. > @@ -4421,7 +4441,8 @@ the {{WritableStream}}'s public API. 1. [=Reject=] |stream|.[=WritableStream/[[inFlightCloseRequest]]=] with |error|. 1. Set |stream|.[=WritableStream/[[inFlightCloseRequest]]=] to undefined. 1. Assert: |stream|.[=WritableStream/[[state]]=] is "`writable`" or "`erroring`". - 1. If |stream|.[=WritableStream/[[pendingAbortRequest]]=] is not undefined, + 1. If |stream|.[=WritableStream/[[pendingAbortRequest]]=] is not undefined and |error| is not an But in this case, the operation fails because of the abort call coming from the producer, so I think it should be rejected with the abort reason. With the other solution, that code would look like: ``` let reject; close_promise = new Promise((res, rej) => reject = rej); const ws = new WritableStream({ start(c) { c.signal.addEventListener('abort', () => { reject(c.abortReason); }); }, close() { return close_promise; } }); const writer = ws.getWriter(); writer.close(); const reason = Exception('hoge'); writer.abort(reason); ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/pull/1132#discussion_r645671757
Received on Friday, 4 June 2021 15:42:54 UTC