Renderingla

iace

Throws a recoverable error.

Aliases: throw

Syntax: iace <expression>

Category

errors

Related

Examples

examples/corpus/iace/iace.fab (canonical · keyword)

Throws a recoverable error.

# 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.

incipit {
    # Bare iace with textus payload
    fac {
        iace "Something went wrong"
    }
    cape err {
        nota "Caught:", err
    }

    # iace with interpolated message
    fixum _ code ← 404
    fac {
        iace "Error code: §"(code)
    }
    cape err {
        nota "Caught:", err
    }

    # Conditional iace inside fac — validation guard
    fixum _ value ← -5
    fac {
        si value < 0 {
            iace "Value must be non-negative"
        }
        nota "Value is valid"
    }
    cape err {
        nota "Validation failed:", err
    }
}

Expected output:

Caught: Something went wrong
Caught: Error code: 404
Validation failed: Value must be non-negative