Documentation
¶
Overview ¶
Package error-types demonstrates every structured error type in go-codex.
Each section triggers one specific error type, shows how to extract it via errors.As or errors.Is, accesses its typed fields, and logs it with slog so the structured LogValue() output is visible.
Error types covered:
- codex.TypeMismatchError — wrong Go type passed to a codec
- codex.ConstraintError — Refine constraint check failed
- codex.ErrMissingField — required struct field absent from input
- codex.ValidationError — single field error from struct decode
- codex.ValidationErrors — all field errors from struct decode
- codex.ElementError — error at a specific slice index
- codex.KeyError — error at a specific map key
- codex.UnknownVariantError — tagged-union discriminator has no matching codec
- codex.VariantError — known variant's codec failed
Run with: go run ./examples/error-types
Click to show internal directories.
Click to hide internal directories.