- From: Adam Rice <notifications@github.com>
- Date: Mon, 26 Nov 2018 23:19:11 -0800
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/966/review/178636342@github.com>
ricea commented on this pull request. > - values are not permitted. - <p class="note"><emu-val>undefined</emu-val> is special-cased here to make it easier to debug errors such as - <code>rs.pipeThrough(writable, readable)</code> which otherwise would silently do nothing. <code><a - lt="pipeThrough()" for="ReadableStream">pipeThrough()</a></code> is - otherwise agnostic about the values that it passes through.</p> - 1. Let _promise_ be ? Invoke(*this*, `"pipeTo"`, « _writable_, _options_ »). - 1. If Type(_promise_) is Object and _promise_ has a [[PromiseIsHandled]] internal slot, set - _promise_.[[PromiseIsHandled]] to *true*. + 1. If ! IsReadableStream(*this*) is *false*, throw a *TypeError* exception. + 1. If ! IsWritableStream(_writable_) is *false*, throw a *TypeError* exception. + 1. If ! IsReadableStream(_readable_) is *false*, throw a *TypeError* exception + 1. Set _preventClose_ to ! ToBoolean(_preventClose_), set _preventAbort_ to ! ToBoolean(_preventAbort_), and set + _preventCancel_ to ! ToBoolean(_preventCancel_). + 1. If _signal_ is not *undefined*, and _signal_ is not an instance of the `<a idl>AbortSignal</a>` interface, throw a + *TypeError* exception. + 1. If ! IsReadableStreamLocked(*this*) is *true*, throw a *TypeError* exception. The alternative would be to error `readable`. That would have the benefit that the whole pipe chain would be errored in the normal case, and so you'd get a rejection rather than an exception. But it wouldn't work properly if `readable` was locked. It also would be a big departure from our behaviour up until now of passing through `readable` unchanged. On balance, I think throwing an exception here is the best approach. -- 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/966#discussion_r236543138
Received on Tuesday, 27 November 2018 07:19:33 UTC