Handling a failure in match
A match on a call handles its outcome: one arm for success, and one for
each failure the call can produce (Match):
function lookup_or_default(key: LookupCode) fails LookupRejected -> LookupResult { return match lookup(key) { success(value) -> value LookupMissing -> "not found" LookupRefused -> reject LookupRejected }}
Every failure needs an arm, and there is no _ for the rest. An arm can
recover with a value, as LookupMissing does here, map to another
failure with reject, or pass the failure on with propagate.
The arms handle only the call itself. A failure that leaves while the
call's arguments are worked out leaves the callable around the match, as
it would anywhere else.
The match errors, the failure.outcome_* rules, are listed on
Logic.
Markdown for agents: /docs/handling-a-failure-in-match.md.Built from Jadpo main at a707efb.