Skip to main content

Function: isFetchTransportFailure()

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / index / isFetchTransportFailure

Function: isFetchTransportFailure()

isFetchTransportFailure(error): boolean

Defined in: packages/gala-core-sdk/dist/index.d.ts:2039

True when a rejection of a fetch-based requestor means NO HTTP ANSWER ARRIVED: the network failed, the connection was reset, the host did not resolve, CORS blocked it. For a write that is not a refusal (the request may have been queued), so this is the default ChainGatewayOptions.isTransportFailure for a requestor that wraps fetch and rejects with its own errors.

  • Yes: a TypeError (what fetch rejects with in every engine: Failed to fetch, Load failed, NetworkError when attempting to fetch resource, undici's fetch failed), recognised by name too so one from another realm (an extension page, an iframe) still counts, and a DOMException named NetworkError.
  • No: an abort (AbortError) or a timeout (TimeoutError). The SDK's own request layer knows whether its timer or the caller's signal aborted, and reports those itself (REQUEST_TIMEOUT, or the caller's own abort unchanged); claiming them here would turn the caller's cancel into "maybe queued".
  • No: anything else, including an SDK error and a value that is not an object.

It never throws.

Parameters​

error​

unknown

Returns​

boolean

Example​

new ChainGateway({ dexBackendBaseUrl, httpRequestor: galaFetch, isTransportFailure: isFetchTransportFailure });