Skip to main content

Variable: problems

const problems: object

Defined in: packages/common/src/problem.ts:241

Factories, one per kind. Each returns a ProblemError to throw, so the call site reads throw problems.notFound().

Type Declaration​

conflict​

readonly conflict: (options) => ProblemError

409, a conflict. retryable: false (the module said so) means the same request can never succeed, so the advice is to re-read and decide rather than to retry once.

Parameters​

options?​

ModuleProblemOptions & object = {}

Returns​

ProblemError

forbidden​

readonly forbidden: (options) => ProblemError

403, for an operation a role never permits. For a RESOURCE the caller may not see, use problems.notFound: the two must be indistinguishable.

Parameters​

options?​

ProblemOptions = {}

Returns​

ProblemError

internal​

readonly internal: (options) => ProblemError

  1. Takes no detail: nothing about our internals reaches the caller.

Parameters​

options?​

Pick<ProblemOptions, "correlationId" | "cause"> = {}

Returns​

ProblemError

misdirectedRequest​

readonly misdirectedRequest: (options) => ProblemError

  1. The request's Host is not one this service answers to. Raised before any handler, so it carries nothing about what the service is.

Parameters​

options?​

ModuleProblemOptions = {}

Returns​

ProblemError

notFound​

readonly notFound: (options) => ProblemError

  1. Deliberately takes no detail: the response for "does not exist" and "exists but out of scope" is byte-identical in status, type, title and body shape (only correlationId differs).

Parameters​

options?​

Pick<ProblemOptions, "correlationId" | "cause"> = {}

Returns​

ProblemError

payloadTooLarge​

readonly payloadTooLarge: (options) => ProblemError

  1. The body exceeded the service's limit; sending it again unchanged cannot work.

Parameters​

options?​

ProblemOptions = {}

Returns​

ProblemError

state​

readonly state: (options) => ProblemError

409, wrong moment.

Parameters​

options?​

ModuleProblemOptions = {}

Returns​

ProblemError

tooManyRequests​

readonly tooManyRequests: (options) => ProblemError

  1. The caller has made more attempts than the service allows. The advice is to stop, not to retry with backoff: a service that answers this has usually decided something (a limit reached, a code burned) that waiting does not undo.

Parameters​

options?​

ModuleProblemOptions = {}

Returns​

ProblemError

unauthenticated​

readonly unauthenticated: (options) => ProblemError

Parameters​

options?​

ProblemOptions = {}

Returns​

ProblemError

unavailable​

readonly unavailable: (options) => ProblemError

Parameters​

options?​

ModuleProblemOptions & object = {}

Returns​

ProblemError

unsupportedMediaType​

readonly unsupportedMediaType: (options) => ProblemError

  1. The body's media type is not one this endpoint reads; sending it again unchanged cannot work.

Parameters​

options?​

ProblemOptions = {}

Returns​

ProblemError

upstream​

readonly upstream: (options) => ProblemError

  1. detail should say whose fault it is (the vendor, the ledger).

Parameters​

options?​

ModuleProblemOptions = {}

Returns​

ProblemError

validation​

readonly validation: (errors, options) => ProblemError

  1. errors names fields and what is wrong, never the submitted values.

Parameters​

errors?​

readonly ProblemFieldError[] = []

options?​

ModuleProblemOptions = {}

Returns​

ProblemError