- From: Adam Rice <notifications@github.com>
- Date: Mon, 23 Jan 2017 04:50:03 -0800
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 23 January 2017 12:50:35 UTC
I found this behaviour surprising: ```javascript promise_test(t => { let pullShouldThrow = false; const rs = new ReadableStream({ pull(controller) { if (pullShouldThrow) { throw error1; } controller.enqueue(0); } }, new CountQueuingStrategy({highWaterMark: 1})); const reader = rs.getReader(); return Promise.resolve().then(() => { pullShouldThrow = true; return Promise.all([ reader.read(), promise_rejects(t, error1, reader.closed, '.closed promise should reject') ]); }); }, 'read should not error if it dequeues and pull() throws'); ``` `read()` doesn't reject because it enters step two at https://streams.spec.whatwg.org/#rs-default-controller-private-pull and so returns before the failure from `pull()` is asynchronously detected. If you change highWaterMark to 0 then you get the other code path and `read()` rejects. Having thought about it a bit this is probably correct. I couldn't find a test for this. If everyone agrees it's the correct behaviour and no-one recalls seeing a test for it anywhere I will contribute this one to w-p-t. -- 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/issues/667
Received on Monday, 23 January 2017 12:50:35 UTC