From developer-essentials
Teaches error handling patterns across languages: exceptions, Result types, error propagation, and graceful degradation. Use when implementing error handling, designing APIs, or improving reliability.
How this skill is triggered — by the user, by Claude, or both
Slash command
/developer-essentials:error-handling-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Build resilient applications with robust error handling strategies that gracefully handle failures and provide excellent debugging experiences.
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 bugsnpx claudepluginhub wshobson/agents --plugin developer-essentialsMaster error handling patterns including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving reliability.
Strategies for handling errors: exceptions, error types, recovery strategies, and error propagation.