Attempt
A call that can fail must say so where it is called. attempt passes the
call's failures on to the caller, whose fails list must include them. A
match on the call handles them instead.
attempt starts a statement: a variable, a return, or a statement on
its own.
var todo: Todo = attempt Todo.get(todo_id)return attempt todo_by_id(todo_id)attempt Todo.get(todo_id)
It can't stand inside an expression, so this is refused:
var total: Stock = Stock(attempt stock_of(a) + attempt stock_of(b))So every point where a callable can stop early is at the start of a line.
attempt on a call that can't fail is an error.
reject and propagate follow the same rule: each starts a statement or
is the result of a match arm, never part of a value
(failure.reject_placement, failure.propagate_placement). More is in
Passing a failure on: attempt.
Markdown for agents: /docs/attempt.md.Built from Jadpo main at a707efb.