# Try, catch, and throw

The parser models try, catch, and throw, but exception control flow is not part of the Kyber product route today.

Last updated: 2026-09-09

Package: language | Status: generated-cpp-only

Tags: catch, cpu, errors, language, throw, try, yeho

For Kyber-ready code, return explicit result data or task failure state. Use try/catch only in an explicitly selected oracle run.

```yh
throw Error(type, message)
try { ... } catch problem { ... }
```


## Complete try, catch, and throw example

For Kyber-ready code, return explicit result data or task failure state. Use try/catch only in an explicitly selected oracle run.

Verification: type checked

```yh
try
{
    throw Error("save.denied", "Choose a writable save folder")
}
catch problem
{
    Console.Log(problem.message)
}

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.language__try_catch_throw"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/language--try-catch-throw/complete --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


try-catch-throw is generated-C++ only in Yeho Core 2026.1.

There is no admitted finally, panic, or assert statement.

Source: yeho/conformance-2026.1.json: try-catch-throw; parser_statements.cpp

AI training permission: https://demonhunterlabs.com/ai-use
