Defjs
Core

createHttpStatusFault

Builds an HTTP_STATUS fault for a non-2xx response whose body decoded against the declared error struct.

@defjs/core · Function

Signature

function createHttpStatusFault<TData>(
  response: DecodedResponse<TData>,
): HttpStatusFaultOf<TData>;

The fault is a native Error named DefjsFault with code: 'HTTP_STATUS', data set to response.body, status copied from the response, and response as passed. The message is Http failure response: <status>, followed by - <statusText> when there is one.

Use createUndecodedHttpStatusFault when no body was decoded.

Parameters

Prop

Type

response DecodedResponse<TData>

The response, carrying the decoded body.

Returns

An HTTP_STATUS fault whose data is that body.

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