MCPcopy Index your code
hub / github.com/nodejs/node / abortAlgorithm

Function abortAlgorithm

lib/internal/webstreams/readablestream.js:1551–1584  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1549 }
1550
1551 function abortAlgorithm() {
1552 let error;
1553 if (signal.reason instanceof AbortError) {
1554 // Cannot use the AbortError class here. It must be a DOMException.
1555 error = new DOMException(signal.reason.message, 'AbortError');
1556 } else {
1557 error = signal.reason;
1558 }
1559
1560 const actions = [];
1561 if (!preventAbort) {
1562 ArrayPrototypePush(
1563 actions,
1564 () => {
1565 if (dest[kState].state === 'writable')
1566 return writableStreamAbort(dest, error);
1567 return PromiseResolve();
1568 });
1569 }
1570 if (!preventCancel) {
1571 ArrayPrototypePush(
1572 actions,
1573 () => {
1574 if (source[kState].state === 'readable')
1575 return readableStreamCancel(source, error);
1576 return PromiseResolve();
1577 });
1578 }
1579
1580 shutdownWithAnAction(
1581 () => SafePromiseAll(actions, (action) => action()),
1582 true,
1583 error);
1584 }
1585
1586 function watchErrored(stream, promise, action) {
1587 if (stream[kState].state === 'errored')

Callers 1

readableStreamPipeToFunction · 0.85

Calls 4

writableStreamAbortFunction · 0.85
readableStreamCancelFunction · 0.85
shutdownWithAnActionFunction · 0.85
actionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…