What problem does it solve?
This Skill helps developers implement robust and idiomatic Go error handling, ensuring clear context, proper error chaining, and effective error management in production applications.
Core Features & Use Cases
- Error Wrapping: Learn to use
fmt.Errorf with %w to add context while preserving the original error.
- Custom Error Types: Define custom error types with
Error() methods and optional Is()/Unwrap() for specific error conditions.
- Sentinel Errors: Understand how to use
errors.New() for comparable error values and check them with errors.Is().
- Error Chains: Inspect complex error chains using
errors.Is() and errors.As() to handle specific error types or values.
- Use Case: Debugging a complex service where errors propagate through multiple layers. This Skill guides you on how to wrap errors at each layer with relevant context and how to inspect the full error chain at the top level to identify the root cause.
Quick Start
Provide guidance on implementing Go error wrapping across multiple application layers.