Themes

Utils/Utils/HTTPError
HTTPError

A standardised HTTP request error. Works together with Working Data to assign HTTPProblemDetails fields to errors on form fields.

Name
Description
Type
new HTTPError

Construct a HTTPError from a Fetch Response and an an optional details extractor.

new HTTPError(response: Response extractDetails?: ExtractDetails = defaultExtractDetails)
[ERROR_KEY]
boolean
extractDetails
ExtractDetails
status

The status code of the HTTP response.

number
statusText

The status name of the HTTP response.

string
details

Extract the HTTPProblemDetails from the Response.

() => Promise<HTTPProblemDetails>
fromDetails
(details: HTTPProblemDetails ) => HTTPError
isHTTPError
(error: unknown ) => error is HTTPError

HTTPProblemDetails

Name
Description
Type
detail

A longer form explanation of the problem.

string
fields

If the problem was with a form request, messages are mapped to the data sent. Working Data will automatically assign these to the originating fields.

Record<string, string>
title

A human readable short title for the problem.

string