Defjs
Core

createNetworkFault

Builds a NET_* PreflightFault, choosing the code from the shape of cause.

@defjs/core · Function

Signature

function createNetworkFault(
  cause: unknown,
  response?: HttpMeta,
): PreflightFault;

Optional response metadata is attached when the transport already had some to report. The cause is kept as cause.

  • NET_ABORTED when isAbortCause recognizes an abort-branded Error (including ERR_ABORTED from another Core copy) or a DOMException named AbortError. The message is Request was aborted.
  • NET_TIMEOUT when isTimeoutCause recognizes a timeout-branded Error (including ERR_TIMEOUT from another Core copy) or a DOMException or Error named TimeoutError. The message is the cause's message, or Request timed out when that is empty.
  • NET_UNREACHABLE for anything else, with the cause's message.

Parameters

Prop

Type

cause unknown

Underlying cancellation, timeout, or transport failure.

response? HttpMeta

Metadata, only where the transport already had some to report.

Returns

A NET_ABORTED, NET_TIMEOUT, or NET_UNREACHABLE fault.

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao