Renderingla

cape

Starts a catch block.

Aliases: catch

Syntax: <structured-statement> cape <name> <block>

Category

errors

Related

Examples

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

Starts a catch block.

# cape — catch handler on fac
#
# GRAMMAR:
#   facStmt :← 'fac' block 'cape' ident block
#
# EXPECTED OUTPUT:
#   Scalar stdout smoke (see body).
#
# BACKEND:
#   Rust/Go: fac/cape emit gap (whitelist: cape/cape.fab).
#

incipit {
    varia numerus attempt ← 0
    fac {
        attempt ← attempt + 1
        si attempt > 1 {
            iace "simulated failure"
        }
        nota "attempt §"(attempt)
    }
    cape err {
        nota "caught"
    }
}

Expected output:

attempt 1