Http module

http_error

procedureextensionexperimentalSource

An error with a status and a detail text (used as it is). The named helpers below take a tprint format instead: not_found("No user %", id).

Example
error := http_error(418, "short and stout");
assert(error.kind == .STATUS && error.status == 418);

Doesn't run in the browser (skipped on wasm).

http_error :: (status: int, detail := "") -> Http_Error

An error with a status and a detail text (used as it is). The named helpers below take a tprint format instead: not_found("No user %", id).

Parameters

status: int
the HTTP status code.
detail := ""
text for the client, used as it is.

Returns

Example
error := http_error(418, "short and stout");
assert(error.kind == .STATUS && error.status == 418);

Doesn't run in the browser (skipped on wasm).

See also