MCPcopy Create free account
hub / github.com/nodejs/node / makeAppropriateNetworkError

Function makeAppropriateNetworkError

deps/undici/src/lib/web/fetch/response.js:480–489  ·  view source on GitHub ↗
(fetchParams, err = null)

Source from the content-addressed store, hash-verified

478
479// https://fetch.spec.whatwg.org/#appropriate-network-error
480function makeAppropriateNetworkError (fetchParams, err = null) {
481 // 1. Assert: fetchParams is canceled.
482 assert(isCancelled(fetchParams))
483
484 // 2. Return an aborted network error if fetchParams is aborted;
485 // otherwise return a network error.
486 return isAborted(fetchParams)
487 ? makeNetworkError(Object.assign(new DOMException('The operation was aborted.', 'AbortError'), { cause: err }))
488 : makeNetworkError(Object.assign(new DOMException('Request was cancelled.'), { cause: err }))
489}
490
491// https://whatpr.org/fetch/1392.html#initialize-a-response
492function initializeResponse (response, init, body) {

Callers 3

schemeFetchFunction · 0.70
httpNetworkOrCacheFetchFunction · 0.70
httpNetworkFetchFunction · 0.70

Calls 5

assignMethod · 0.80
isCancelledFunction · 0.70
isAbortedFunction · 0.70
makeNetworkErrorFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected