ErrorStatuses

class ErrorStatuses(manifest: Manifest, overrides: Map<String, Int> = emptyMap())

The HTTP status of each error code, from the Manifest's tables:

  1. a status the host configures for the code (overrides) wins;

  2. then the table of the context the command was sent to (its domain rejection codes);

  3. then the Manifest's framework table, and FrameworkErrors.ALL for a Manifest that lists none;

  4. else a domain rejection is 422 (FrameworkErrors.DOMAIN_REJECTION_STATUS) and an unknown framework code (wow.*) 500.

wow.aggregate.version-mismatch is 412 instead of its table status when the request carried If-Match. What a retry may do, and its Retry-After, the problem takes from the error catalog (Problem.retry).

Constructors

Link copied to clipboard
constructor(manifest: Manifest, overrides: Map<String, Int> = emptyMap())

Functions

Link copied to clipboard
fun problemOf(failure: WowProblemException, context: String? = null): Problem

The problem of failure, answered as it is wherever it is thrown (an application route, a service route relaying another service's answer): its status, its code and its result, and what a retry may do with its Retry-After, in whole seconds rounded up, as the failure says, not as the catalog would for its code, which may not even know it. Its title is the code's in context.

fun problemOf(result: CommandResult, ifMatch: Boolean = false): Problem

The problem of result, a command that did not succeed.

fun problemOf(code: String, detail: String, context: String? = null): Problem

A problem with code before the command has a ref.

Link copied to clipboard
fun status(code: String, context: String? = null, ifMatch: Boolean = false): Int

The status of code for a command of context; ifMatch when the request carried If-Match.

Link copied to clipboard
fun title(code: String, context: String?, status: Int): String

The title of a problem with code and status, the same for every occurrence of the code (RFC 9457): a framework code's short title (FrameworkErrors.TITLES), a domain code's description in its context's table, else the reason phrase. The request's own account is the problem's detail.