failure.mapping_kind
Mapped failure's kind does not fit its condition.
Area 4, Failures; not declinable; the next step is usually the agent's.
type Quantity = Int { min: 1 max: 1000}type QuantityRefused = Failure { kind: FailureKind.rejected}function doubled(quantity: Quantity) fails QuantityRefused -> Quantity { var result: Quantity = attempt Quantity(quantity * 2) { max: QuantityRefused } return result}
error max: needs an invalid_value failure, and QuantityRefused is rejected
--> main.jadpo:12:14
|12 | max: QuantityRefused | ^^^^^^^^^^^^^^^ kind `rejected`
- reason
- Each mapping's condition fixes the kind of failure it becomes: a value that breaks a type's rules is
invalid_value, so the client gets the status that means. - next
- Name an
invalid_valuefailure here, or makeQuantityRefused's kindFailureKind.invalid_value(agent) - rule
- failure.
mapping_ kind - help
- https://jadpo.
dev/docs/errors/failure. mapping_ kind
Markdown for agents: /docs/errors/failure.mapping_kind.md.Built from Jadpo main at aee2e8f.