errorx-conventions

Standardize Go error handling with errorx types and safe wrapping practices.

3|Updated Aug 19, 2024
One-click install
npx skills add https://github.com/hashgraph/solo-weaver --skill errorx-conventions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: errorx-conventions
Source: https://github.com/hashgraph/solo-weaver/tree/main/.claude/skills/errorx-conventions
Command: npx skills add https://github.com/hashgraph/solo-weaver --skill errorx-conventions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardizes and guides Go error construction to prevent inconsistent use of stdlib errors and ensure all production code uses errorx conventions. It reduces lint errors and improves error classification across the codebase.

Core Features & Use Cases

  • Namespace guidance: maps Go error shapes to the correct errorx namespaces to yield actionable error reporting.
  • Migration traps: highlights common migration pitfalls when converting from errors.New/fmt.Errorf to errorx wrappers.
  • Sentinel patterns: prescribes how to declare and use sentinel errors with errorx types.
  • Test considerations: clarifies lint exemptions for *_test.go files and testing strategies.
  • Best-practice enforcement: codifies rule sets to maintain consistent error composition in cmd/, internal/, and pkg/.

Quick Start

Apply these conventions when editing Go error handling in production code to ensure consistent error wrapping with errorx.

Frequently Asked Questions about errorx-conventions

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

FAQPage Schema
How do I standardize Go error handling with errorx across production code?

Standardize Go error handling by selecting errorx types and enforcing safe wrapping practices across cmd/, internal/, and pkg/ directories to ensure consistent error construction and reduce lint errors.

What are common migration traps when converting errors.New to errorx wrappers?

Common migration traps when converting stdlib errors.New and fmt.Errorf to errorx wrappers include incorrect namespace selection and breaking sentinel error references, which this convention guides to prevent inconsistent error classification.

How do I declare and use sentinel errors with errorx types in Go?

Declare and use sentinel errors with errorx types by following prescribed patterns that maintain interoperability with errors.Is and errors.As, ensuring safe error composition and actionable error reporting in production code.

Can I use errorx lint conventions in Go test files?

Yes, errorx lint conventions apply to Go test files with specific exemptions and testing strategies, clarifying allowed lint exemptions for *_test.go files while maintaining consistent error handling rules for production code.

How do I map Go error shapes to the correct errorx namespaces?

Map Go error shapes to the correct errorx namespaces using guidance that matches error constructions to appropriate namespaces, yielding actionable error reporting and improving error classification across the codebase.

Why does errorx standardization prevent inconsistent use of stdlib errors in Go?

Errorx standardization prevents inconsistent use of stdlib errors by codifying rule sets for error composition, enforcing safe wrapping practices, and guiding migration from errors.New and fmt.Errorf to errorx wrappers.