# Typed error values

error is a typed value created with Error(type, message) and exposes type and message fields.

Last updated: 2026-09-09

Package: language | Status: experimental

Tags: Error, cpu, error, errors, language, message, type, yeho

Use an error value when failure needs to cross a function or task boundary with machine-readable identity and a human-readable explanation.

```yh
error problem = Error(type, message)
```


## Name the failure

Use an error value when failure needs to cross a function or task boundary with machine-readable identity and a human-readable explanation.

Verification: type checked

```yh
error problem = Error("save.denied", "The project folder is read only")
Console.Error(problem.type + ": " + problem.message)

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.language__error_values"
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--error-values/complete-0 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Errors and contracts are experimental.

Prefer stable error type strings that callers can test without parsing prose.

Source: yeho/errors-tasks-effects-2026.1.json; language-core.md §6

AI training permission: https://demonhunterlabs.com/ai-use
