golang-error-handling

Implement Go error taxonomy, propagation, and multi-error aggregation strategies.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/ep0ll/bons-ci --skill golang-error-handling-ep0ll
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-error-handling
Source: https://github.com/ep0ll/bons-ci/tree/main/.agents/skills/error-handling
Command: npx skills add https://github.com/ep0ll/bons-ci --skill golang-error-handling-ep0ll

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires errors, fmt, strings, sort, and includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive strategies for error management in Go, including taxonomy, propagation, and aggregation, to improve code reliability and debuggability.

Core Features & Use Cases

  • Error Taxonomy: Differentiates sentinel, typed, and wrapped errors for clear error classification.
  • Error Propagation: Establishes best practices for wrapping, unwrapping, and handling errors across layers.
  • Use Case: Implement consistent error handling in a microservice architecture to improve traceability and maintainability.

Quick Start

Use the error handling principles to structure error management in your Go application.

Frequently Asked Questions about golang-error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I wrap and propagate errors across layers in a Go microservice?

To propagate errors in Go, you wrap them with additional context at each layer using fmt.Errorf, then unwrap and classify them at the top level to map errors to HTTP or gRPC responses for reliable diagnostics.

What is the best way to aggregate multiple errors in Go?

Aggregating multiple errors in Go involves combining them into a single error value using multi-error aggregation strategies, allowing your application to return a comprehensive diagnostic report instead of failing on the first encountered error.

How do I map wrapped Go errors to HTTP and gRPC responses?

Mapping wrapped Go errors to HTTP and gRPC responses requires establishing an error taxonomy that differentiates sentinel, typed, and wrapped errors, then translating those specific categories into appropriate HTTP status codes or gRPC response codes.

When should I use sentinel errors vs typed errors in Go?

Use sentinel errors in Go for specific expected values like io.EOF, and use typed errors when you need to carry structured data, establishing a clear error taxonomy to differentiate sentinel, typed, and wrapped errors for better classification.

Does this Go error handling approach support production-grade systems?

Yes, this error handling approach supports production-grade Go systems by implementing thorough error taxonomy, propagation, multi-error aggregation, and recovery mechanisms to ensure reliable error diagnostics and validation across microservice architectures.