error-handling-patterns
CommunityHandle errors gracefully, build resilient systems.
Software Engineering#error handling#validation#exceptions#resilience#retry logic#circuit breaker#Result pattern
Authormarcioaltoe
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill provides comprehensive guidance on implementing robust and maintainable error handling. It helps developers choose the right strategy (exceptions vs. Result pattern), provide rich error context, and implement recovery mechanisms like retries and circuit breakers, leading to more resilient applications.
Core Features & Use Cases
- Exceptions vs. Result Pattern: Guides on when to use exceptions for unexpected errors and the Result pattern for expected business failures.
- Custom Exception Hierarchy: Defines domain-specific and infrastructure-specific custom error classes with rich context.
- Validation Strategies: Emphasizes input validation at system boundaries (e.g., with Zod) and domain validation within entities.
- Error Recovery: Implements retry logic, circuit breakers, and fallback values for transient failures and external service dependencies.
- Use Case: "Implement the Result pattern for a
findByEmailoperation in myUserServiceto gracefully handle 'user not found' scenarios without throwing exceptions."
Quick Start
Refactor a function to use custom exceptions with rich context instead of generic Error objects.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: error-handling-patterns Download link: https://github.com/marcioaltoe/claude-craftkit/archive/main.zip#error-handling-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.