syntax.try_catch
Failure handled with try, catch or ?.
Area 3, Logic; not declinable; the next step is usually the agent's.
A call that can fail is marked where it is made: attempt passes its failures on, and a match on the call handles them. try { and catch have no edit, since what to do with each failure is the author's to say.
type Count = Int { min: 0}type CountMissing = Failure { kind: FailureKind.not_found}function counted_or_missing(count: Count) fails CountMissing -> Count { if (count == 0) { reject CountMissing } return count}function first(count: Count) fails CountMissing -> Count { var result: Count = try counted_or_missing(count) return result}
error Jadpo writes attempt, not try
--> main.jadpo:17:25
|17 | var result: Count = try counted_or_missing(count) | ^^^ write `attempt`
- reason
trymarks a call that can fail in Swift; Jadpo writesattempt, which passes the call's failures on to the caller.- next
- Use
attemptinstead oftry(agent) - rule
- syntax.
try_ catch - help
- https://jadpo.
dev/docs/errors/syntax. try_ catch
Markdown for agents: /docs/errors/syntax.try_catch.md.Built from Jadpo main at aee2e8f.