MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / ReadableStreamError

Function ReadableStreamError

examples/io/streams/modules/streams.js:1364–1379  ·  view source on GitHub ↗
(stream, e)

Source from the content-addressed store, hash-verified

1362 }
1363}
1364function ReadableStreamError(stream, e) {
1365 const state = stream.state;
1366 assert(state == "readable");
1367 stream.state = "errored";
1368 trace(`ReadableStreamError ${e}\n`);
1369 stream.storedError = e;
1370 const reader = stream.reader;
1371 if (reader === undefined)
1372 return;
1373 rejectPromise(reader.closedPromise, e);
1374 handlePromise(reader.closedPromise);
1375 if (ReadableStreamDefaultReaderBrand.has(reader.self))
1376 ReadableStreamDefaultReaderErrorReadRequests(reader, e);
1377 else
1378 ReadableStreamBYOBReaderErrorReadIntoRequests(reader, e);
1379}
1380function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) {
1381 assert(ReadableStreamHasBYOBReader(stream));
1382 const reader = stream.reader;

Calls 6

rejectPromiseFunction · 0.85
handlePromiseFunction · 0.85
assertFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected