error_handling

Implement error handling patterns including exceptions, Result types, retries, and circuit breakers across languages.

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/jvsandhu/agentic-skills --skill error-handling-jvsandhu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error_handling
Source: https://github.com/jvsandhu/agentic-skills/tree/main/skills/error_handling
Command: npx skills add https://github.com/jvsandhu/agentic-skills --skill error-handling-jvsandhu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Applications crash or fail silently when errors are handled inconsistently, making debugging painful and degrading user experience. This Skill provides proven error handling patterns so failures are caught, logged with context, and recovered from gracefully. ## Core Features & Use Cases - Language-Specific Patterns: Custom exception hierarchies, Result types, and error propagation for Python, TypeScript/JavaScript, Rust, and Go. - Resilience Patterns: Circuit breakers, retry with exponential backoff, error aggregation, and graceful degradation with fallbacks. - Phased Workflow: Prevention, runtime handling, and monitoring phases with checkpoints covering typed errors, context logging, and Sentry-style alerting. - Use Case: When building an API endpoint that calls an external payment service, apply the circuit breaker and retry patterns to prevent cascading failures and wrap external errors with meaningful context. ## Quick Start Ask the agent to review your function that calls an external API and add proper error handling with retries, typed errors, and contextual logging.

Frequently Asked Questions about error_handling

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

FAQPage Schema
How do I implement a circuit breaker pattern in Python?

Implement a circuit breaker by tracking failure counts and state (CLOSED, OPEN, HALF_OPEN) around external calls. After a failure threshold, requests are rejected until a timeout passes, then trial requests test recovery before closing the circuit again.

Should I use exceptions or Result types for error handling?

Use exceptions for unexpected, exceptional conditions and Result types for expected failures like validation errors. Result types make error paths explicit in function signatures, while exceptions suit truly exceptional situations that disrupt normal control flow.

How do I add retry with exponential backoff to API calls?

Wrap the call in a retry decorator that catches specified exceptions and sleeps for backoff_factor raised to the attempt number between tries. Limit max attempts and only retry transient errors like network timeouts, not validation failures.

Does this error handling approach work with async code?

Yes, async error handling uses try-catch around awaited calls, with specific handling per error type such as returning defaults for NotFound or retrying network errors. Unhandled promise rejections must be caught explicitly to avoid silent failures.

Why should I avoid catching generic Exception in Python?

Catching generic Exception hides programming bugs like null references and makes debugging harder. Catch specific exception types, log unexpected errors with full context, and re-raise them wrapped in meaningful application errors.