← ClaudeAtlas

golang-samber-oopslisted

Create, wrap, expose, log, or test structured errors with `github.com/samber/oops`, including codes, attributes, public messages, stacks, context builders, and panic recovery. Use when a project already uses oops or deliberately adopts its structured error contract.
reagin/agent-skills · ★ 0 · Code & Development · score 63
Install: claude install-skill reagin/agent-skills
# samber/oops structured errors Inspect `go.mod`, local builder helpers, transport mapping, `errors.Is`/`errors.As` checks, logger formatting, recovery middleware, and tests. Preserve the project's code vocabulary, public-message policy, stack policy, and redaction rules. ## Build the intended error contract The fluent builder surface is version-sensitive. Common categories include: | Purpose | Representative API | | --- | --- | | Domain and classification | `In`, `Tags`, `Code` | | Diagnostic attributes | `With`, `WithContext`, `Hint`, `Owner` | | Identity and tracing | `User`, `Tenant`, `Trace`, `Span` | | Safe client text | `Public` | | Timing and protocol context | `Time`, `Since`, `Duration`, `Request`, `Response` | | Context reuse | `WithBuilder`, `FromContext` | Verify signatures and data captured by each builder in the pinned release. In particular, request and response helpers may optionally capture bodies, headers, or URLs that require redaction. Use a stable `Code` when callers, transport adapters, metrics, or retry decisions depend on it. Keep variable diagnostics in attributes when the logging backend groups on message, while respecting its cardinality model. Public messages and internal messages are separate contracts. ## Choose the terminal operation Representative terminal methods include: - `Errorf` for a new structured error; - `Wrap` or `Wrapf` for retaining an underlying cause; - `Join` for several independent failures; - `Recover` or `Recoverf` f