You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non readable stream should throw when errored while not readable #39756
TypeError
The source object is not a ReadableStreamDefaultController, or the stream is not readable for some other reason.
const{ ReadableStream }=require('stream/web')letcconsts=newReadableStream({start(controller){c=controller}})c.close()try{c.error()}catch(err){console.error(err)// This should log an error}
The above snippet doesn't log an error in any of the WHATWG stream implementation (I've tried Deno, Firefox, Safari, and Chromium), whatever the spec says I think we're good as long as all the implementation are aligned.
Activity
ronag commentedon Aug 13, 2021
@jasnell @nodejs/streams
ofirbarak commentedon Nov 21, 2021
But it says also we can call
erroreven when the stream is not readable. Maybe a mistake in the doc?aduh95 commentedon Mar 6, 2022
The above snippet doesn't log an error in any of the WHATWG stream implementation (I've tried Deno, Firefox, Safari, and Chromium), whatever the spec says I think we're good as long as all the implementation are aligned.
aduh95 commentedon Mar 6, 2022
Maybe the MDN page is wrong, looking at the spec it says:
It says the method should return, not throw an exception. I'll open a PR to mdn/content to fix the page.
jasnell commentedon Mar 6, 2022
Yeah, as surprising as it may be, the behavior here is correct and MDN is wrong.
aduh95 commentedon Mar 6, 2022
Fixed by mdn/content#13581.