iace
Translation status: English reader-locale proof. Code fences render through the en pipeline; prose is canonical Latin.
Throws a recoverable error.
Syntax: iace <expression>
Category#
errors
Related#
Examples#
radix/corpus/iace/iace-si-guard.fab (canonical · keyword)#
Conditional throw with si guard.
# =============================================================================
# iace — Conditional throw with si guard
# =============================================================================
#
# What this teaches:
# • Conditional throw with si guard.
# • Related keywords: cape, mori, si, ⇥
#
# Common mistakes:
# • Using `iace si` without a `⇥` on the enclosing function or a `fac/cape` wrapper — the guard sugar expands to `si cond { iace val }`, which still needs an error context.
#
# See also: cape, mori, si, ⇥
# =============================================================================
# iace with optional si guard
#
# iace <value> [si <condicio>]
#
# GRAMMAR:
# throwStmt :← 'iace' expr ['si' expr]
#
# The optional `si` guard is parser sugar:
# iace val si cond → si cond { iace val }
#
# Without the guard, iace is unconditional (unchanged).
#
# EXPECTED OUTPUT:
# "ok: valid input"
# "caught: empty input"
# "caught: negative"
fn validata(string input) → string ⇥ string {
# Guard: throw if input is empty
throw "empty input" if input.longitudo() ≡ 0
return "valid: §"(input)
}
main {
# Happy path — guard not triggered
do {
const string a ← validata("hello")
print "ok: §"(a)
}
catch err {
print "unexpected: §"(err)
}
# Empty input — iace si guard triggers
do {
const string b ← validata("")
print "should not reach"
}
catch err {
print "caught: §"(err)
}
# iace with si on same line
do {
throw "force throw" if true
print "should not reach"
}
catch err {
print "caught: §"(err)
}
}radix/corpus/iace/iace.fab (canonical · keyword)#
Throws a recoverable error.
# =============================================================================
# iace — Throws a recoverable error
# =============================================================================
#
# What this teaches:
# • Throws a recoverable error.
# • Related keywords: ⇥, cape, mori, redde
#
# Common mistakes:
# • Using `iace` without a `⇥` on the enclosing function or a `fac { ... } cape err { ... }` wrapper — `iace` requires an error-handling context (SEM010).
#
# See also: ⇥, cape, mori, redde
# =============================================================================
# iace — recoverable throw and cape handler
#
# iace <value>
# fac { <body> }
# cape err { <handler> }
#
# GRAMMAR:
# throwStmt :← 'iace' expr
# facStmt :← 'fac' block catchClause?
#
# EXPECTED OUTPUT:
# Caught error messages from fac/cape recovery paths.
#
# BACKEND:
# Rust/Go lowering does not emit iace/cape yet — compile-only smoke.
main {
# Bare iace with textus payload
do {
throw "Something went wrong"
}
catch err {
print "Caught:", err
}
# iace with interpolated message
const _ code ← 404
do {
throw "Error code: §"(code)
}
catch err {
print "Caught:", err
}
# Conditional iace inside fac — validation guard
const _ value ← -5
do {
if value < 0 {
throw "Value must be non-negative"
}
print "Value is valid"
}
catch err {
print "Validation failed:", err
}
}Expected output:
Caught: Something went wrong
Caught: Error code: 404
Validation failed: Value must be non-negative