failure.kind_required
A failure is declared without a kind: saying what sort of failure it is.
Area 4, Failures; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
A failure's kind, such as not_found or conflict, decides how it
reaches a client, its HTTP status included, and how background work such
as a job treats it. A failure never states a status itself, so without a
kind Jadpo has no way to answer a client with it.
What it looks like
main.jadpo:
type Missing = Failure { message: "Not found."}
error Missing has no kind
--> main.jadpo:1:6
|1 | type Missing = Failure { | ^^^^^^^ a failure without a kind
- reason
- A failure's kind decides how it reaches a client, its HTTP status included, and how background work treats it, so every failure names one.
- next
- Add
kind:with theFailureKindthat fits, such askind: FailureKind.not_found(agent) - rule
- failure.
kind_ required - help
- https://jadpo.
dev/docs/errors/failure. kind_ required
(agent) at the end of the next: line means your coding agent can make
the fix itself.
How to fix it
If the failure is for something that doesn't exist, add
kind: FailureKind.not_found:
kind: FailureKind.not_foundA client that gets Missing gets a 404, with the code missing and the
message "Not found.".
For another outcome, use the kind that fits it. You can declare seven:
invalid_value (422) for a value that breaks a rule, not_permitted
(403), not_found (404), conflict (409), rejected (422) for a
business rule that refuses the operation, rate_limited (429) and
unavailable (503). The runtime raises the others itself
(Failure kinds).
Related
Markdown for agents: /docs/errors/failure.kind_required.md.Built from Jadpo main at aee2e8f.