
The error-handling-patterns skill teaches developers how to implement robust error handling across multiple programming languages using techniques like exceptions, Result types, error propagation, and graceful degradation. It serves developers building resilient applications who need guidance on choosing appropriate error handling strategies, designing fault-tolerant systems, and improving debugging experiences. The skill solves the problem of inconsistent or inadequate error handling by providing language-specific patterns and clear guidance on when to use exceptions versus Result types, how to categorize errors as recoverable or unrecoverable, and how to implement advanced patterns like retry and circuit breaker mechanisms.
$ npx -y skills add wshobson/agents --skill error-handling-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Build resilient applications with robust error handling strategies that gracefully handle failures and provide excellent debugging experiences.
Exceptions vs Result Types:
When to Use Each:
Recoverable Errors:
Unrecoverable Errors:
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
# Good error handling example
def process_order(order_id: str) -> Order:
"""Process order with comprehensive error handling."""
try:
# Validate input
if not order_id:
raise ValidationError("Order ID is required")
# Fetch order
order = db.get_order(order_id)
if not order:
raise NotFoundError("Order", order_id)
# Process payment
try:
payment_result = payment_service.charge(order.total)
except PaymentServiceError as e:
# Log and wrap external service error
logger.error(f"Payment failed for order {order_id}: {e}")
raise ExternalServiceError(
f"Payment processing failed",
service="payment_service",
details={"order_id": order_id, "amount": order.total}
) from e
# Update order
order.status = "completed"
order.payment_id = payment_result.id
db.save(order)
return order
except ApplicationError:
# Re-raise known application errors
raise
except Exception as e:
# Log unexpected errors
logger.exception(f"Unexpected error processing order {order_id}")
raise ApplicationError(
"Order processing failed",
code="INTERNAL_ERROR"
) from e
except Exception hides bugsSponsors