Skip to content

@adrianhall/cloudflare-toolkit


@adrianhall/cloudflare-toolkit / index / problemDetails

Function: problemDetails()

problemDetails<T>(input): ProblemDetailsError

Defined in: src/lib/problem-details/factory.ts:21

Create a ProblemDetailsError from the given input. Missing type defaults to "about:blank"; missing title is derived from the status code.

Type Parameters

T

T extends Record<string, unknown>

Parameters

input

ProblemDetailsInput<T>

The problem details input.

Returns

ProblemDetailsError

A ProblemDetailsError ready to throw.

Example

ts
throw problemDetails({
  status: 404,
  detail: `Order ${orderId} does not exist`,
});