Skip to content
Back to skills

Error Handling Patterns

ASecurity

Error handling patterns across languages — exceptions, Result types, propagation, graceful degradation. Use when implementing error handling, designing APIs, or improving reliability.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 9, 2026
developmentjavascripttypescriptpythonrustgojavadebuggingapi

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned October 9, 2026

npx -y skills add HigorAlves/orc --skill error-handling-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Error Handling Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Error Handling Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/higoralves-error-handling-patterns/badge)](https://www.skillsdirectory.com/skills/higoralves-error-handling-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: error-handling-patterns
description: Error handling patterns across languages — exceptions, Result types, propagation, graceful degradation. Use when implementing error handling, designing APIs, or improving reliability.
---

# Error Handling Patterns

Build resilient applications with robust error handling strategies that gracefully handle failures and provide excellent debugging experiences.

This SKILL.md is a thin index. **Read the relevant `references/<topic>.md` file** only when you need that topic's detail — the code samples and full patterns live there, not here.

## When to Use This Skill

- Implementing error handling in new features
- Designing error-resilient APIs
- Debugging production issues
- Improving application reliability
- Creating better error messages for users and developers
- Implementing retry and circuit breaker patterns
- Handling async/concurrent errors
- Building fault-tolerant distributed systems

## Core Concepts

**Error handling philosophies:**

- **Exceptions** — traditional try-catch, disrupts control flow.
- **Result types** — explicit success/failure, functional approach.
- **Error codes** — C-style, requires discipline.
- **Option/Maybe types** — for nullable values.

**Error categories:**

- **Recoverable** — network timeouts, missing files, invalid user input, API rate limits. Handle and continue (retry, fallback).
- **Unrecoverable** — out of memory, stack overflow, programming bugs (null pointer). Fail loudly / crash.

## Decision Tree — which strategy?

```
Is the failure expected as part of normal operation
(validation, parse, lookup miss, rate limit)?
├── YES → Return a Result / Option type.            → references/result-types.md
│         Caller must explicitly handle the failure.
└── NO  → Is it a programming bug or truly unrecoverable
          (OOM, invariant violation)?
          ├── YES → Panic / crash. Don't try to recover.
          └── NO  → It's an unexpected-but-recoverable error
                    → Throw an exception.               → references/exceptions.md

Then, regardless of strategy:
- Does the error cross layers / async boundaries, or do you
  need to collect several before surfacing?      → references/propagation.md
- Is this a flaky external / distributed dependency you must
  keep serving through (retry, circuit breaker, fallback)?
                                                  → references/graceful-degradation.md
- Need the language-native idiom or full type defs?
                                                  → references/language-specific.md
- Unsure about messaging, logging, or cleanup hygiene?
                                                  → references/best-practices.md
```

## Topic Index

| Topic | Read when you need… | Reference |
|-------|--------------------|-----------|
| Exceptions | Custom exception hierarchies, throwing, try-except/catch structure, context-manager cleanup, the full comprehensive handler example | `references/exceptions.md` |
| Result & Option types | Explicit `Result<T, E>` / `Option` values for expected errors and validation; helpers, chaining, consuming | `references/result-types.md` |
| Propagation | Re-throwing, wrapping/chaining for context (`%w`, `errors.Is`/`As`, `?`), async/promise propagation, error aggregation | `references/propagation.md` |
| Graceful degradation | Retry with backoff, circuit breaker, fallbacks/degraded mode for recoverable & distributed failures | `references/graceful-degradation.md` |
| Language-specific | Per-language idioms and full type scaffolding (Python, TypeScript/JavaScript, Rust, Go) | `references/language-specific.md` |
| Best practices & pitfalls | Cross-cutting rules (fail fast, preserve context, log appropriately) and anti-patterns to avoid | `references/best-practices.md` |

Files in this skill

  • SKILL.md3.8 KB
  • references/best-practices.md1.2 KB
  • references/exceptions.md4.1 KB
  • references/graceful-degradation.md4.7 KB
  • references/language-specific.md2.2 KB
  • references/propagation.md3.4 KB
  • references/result-types.md2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…