# klauthed-error

The zero-dependency **error kernel** for the klauthed crates. It owns only the shared
contract — not concrete error types.

- `ErrorCategory` — `BadRequest` / `Unauthorized` / `Forbidden` / `NotFound` / `Conflict`
  / `RateLimited` / `Timeout` / `Unavailable` / `Internal`, with `http_status()` and
  `is_retryable()`.
- `ErrorCode` — a newtype over `Cow<'static, str>` following the `domain.reason`
  convention (e.g. `security.expired_token`).
- `DomainError` — the trait every crate's error type implements: `category()` + `code()`,
  with `http_status()` / `is_retryable()` defaulted from the category.

Concrete error enums live in their own crates (e.g. `ConfigError` in `klauthed-core`,
`SecurityError` in `klauthed-security`) and `impl DomainError` — usually generated by
`#[derive(DomainError)]` from [`klauthed-macros`](../klauthed-macros/). An optional
`serde` feature derives `Serialize`/`Deserialize` for the shared types.

---

Part of the [klauthed rust-libraries](../README.md) workspace.
Browse the API: `cargo doc -p klauthed-error --open`.

## License

Dual-licensed under [MIT](../LICENSE-MIT) or [Apache-2.0](../LICENSE-APACHE), at your option.
