Errors
Errors
The errors package provides structured error types and thin wrapping helpers used
across launcher. Application code uses these helpers instead of calling fmt.Errorf
directly, so that error wrapping is consistent and machine-inspectable.
Structured error types
ValidationError is returned when a semantic constraint is violated. It serves two
shapes:
- Enum errors (unknown value): populate
Value+ValidValuesviaNewValidationError(field, value, component, validValues). - Custom-message errors (missing field, bad format): populate
Message.
ParseError is returned when a document fails YAML parsing; it carries Kind,
File, Line, Column, and the wrapped cause (NewParseError(...)), and supports
errors.Unwrap.
Wrapping helpers
Wrap/Wrapf return nil when the input error is nil, so they are safe to use
unconditionally.
API overview
| Symbol | Purpose |
|---|---|
ValidationError, NewValidationError | Semantic constraint violations (enum or custom). |
ParseError, NewParseError | YAML parse failures with location. |
New, Errorf | Create plain/formatted errors. |
Wrap, Wrapf | Wrap an error with context (nil-safe). |
Is, As | errors.Is/errors.As passthroughs for inspection. |