What problem does it solve?
This Skill helps Go engineers replace vague, context-poor error handling with structured, code-based errors that include stack traces and rich attributes, so on-call debugging and monitoring become faster and more reliable.
Core Features & Use Cases
- Structured context on errors: Attach key-value attributes using builder methods like With(), WithContext(), User(), Tenant(), and Trace/Span for consistent diagnostics across layers.
- Error codes and public messages: Provide machine-readable identifiers via Code() and user-safe responses via Public(), keeping technical details separate from what clients see.
- Fluent builder pattern for consistency: Standardize error creation with In(), Tags(), Errorf(), Wrap()/Wrapf(), Join(), and Recover() to ensure uniform patterns across services.
- Panic-to-error recovery: Use Recover() at goroutine boundaries to convert panics into structured errors with context and stack traces.
- Context propagation through middleware: Persist an error builder in request context with WithBuilder() and retrieve it downstream with FromContext().
- APM-friendly low-cardinality messages: Keep Errorf/Wrapf messages stable while moving variable data into attributes so telemetry groups correctly.
Quick Start
Apply samber/oops in your Go code by creating errors with the fluent builder (set domain with In(), attach variable fields with With/WithContext/User/Tenant, set Code() and optionally Public()), wrapping underlying errors with Wrapf(), and using Recover() to convert panics into structured, stack-traced errors.