Defjs
Core

createPreflightFault

Builds a fault for a failure that may have happened before any response existed.

@defjs/core · Function

Signature

function createPreflightFault(
  code: PreflightFaultCode,
  cause?: unknown,
  response?: HttpMeta,
): PreflightFault;

When cause is given, its message becomes the fault message; otherwise the code is the message. The result is a native Error named DefjsFault with code, plus response when one was given.

Parameters

Prop

Type

code PreflightFaultCode

The specific failure.

cause? unknown

Underlying value, when there is one; the code becomes the message otherwise.

response? HttpMeta

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

Returns

A preflight fault.

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