Engineering
error-handling-patterns avatar

error-handling-patterns

Master cross-language error handling patterns: exceptions, Result types, and graceful degradation for resilient application development.

Introduction

This skill provides a comprehensive framework for implementing robust error handling strategies across multiple programming environments, primarily focusing on Python and TypeScript/JavaScript. It helps developers move beyond basic try-catch blocks to implement sophisticated, production-grade error propagation, recovery, and reporting mechanisms. The skill is designed for software engineers, systems architects, and SREs who need to improve system reliability, reduce debugging time, and ensure that applications fail gracefully when faced with network instability, logic errors, or external service dependencies.

  • Advanced error handling philosophies comparing Exception objects, functional Result types, and C-style error codes for various architectural needs.

  • Implementation patterns for custom exception hierarchies, allowing for standardized error classification and detailed metadata reporting.

  • Retry logic with exponential backoff and circuit breaker pattern implementations to improve resilience in distributed systems.

  • Context manager and decorator-based patterns for resource cleanup and automated transaction management in Python.

  • Functional error handling with Result types in TypeScript to avoid side-effect-heavy control flow and improve type safety.

  • Clear distinction between recoverable errors (network timeouts, API limits) and unrecoverable errors (memory exhaustion, programming bugs).

  • Use this skill when designing public-facing APIs, building microservices, or refactoring legacy codebases for improved maintainability.

  • Ideal for mapping internal error codes to user-friendly messages for improved frontend debugging and UX.

  • Requires clean separation of business logic and error handling code; verify that your language version supports the demonstrated patterns like context managers or custom error classes.

  • Expected outputs include more reliable control flow, decreased production incident duration, and cleaner codebases through centralized error handling logic.

Repository Stats

Stars
194
Forks
26
Open Issues
4
Language
Python
Default Branch
main
Sync Status
Idle
Last Synced
Apr 30, 2026, 07:59 AM
View on GitHub