Patterns for robust error handling across TypeScript, Python, and Go. Covers typed errors, error boundaries, retries, circuit breakers, and user-facing error messages.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# Error Handling Patterns
Consistent, robust error handling patterns for production applications.
## When to Activate
- Designing error types or exception hierarchies for a new module or service
- Adding retry logic or circuit breakers for unreliable external dependencies
- Reviewing API endpoints for missing error handling
- Implementing user-facing error messages and feedback
- Debugging cascading failures or silent error swallowing
## Core Principles
1. **Fail fast and loudly** — surface errors at the boundary where they occur; don't bury them
2. **Typed errors over string messages** — errors are first-class values with structure
3. **User messages ≠developer messages** — show friendly text to users, log full context server-side
4. **Never swallow errors silently** — every `catch` block must either handle, re-throw, or log
5. **Errors are part of your API contract** — document every error code a client may receive
## TypeScript / JavaScript
### Typed Error Classes
```typescript
// Define an error hierarchy for your domain
export class AppError extends Error {
constructor(
message: string,
public readonly code: string,
…
The line at the top of this page pins the label git:20260816.6319ca5, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
GET https://markdownregistry.com/api/v1/artifacts/art_ixn5lnxtgokfnn6c
GET https://markdownregistry.com/api/v1/resolve?ref=chadixearth/graphyloop/error-handling
GET https://markdownregistry.com/api/v1/blob/54ab40d36bdc0ab028be94283033268e15a49c39789969416f3e1f0694c2dff3
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
chadixearth/graphyloop · integrations/claude-code/skills/graphyloop-waves/SKILL.md · Use this skill when a request spans more than one layer (database + backend + frontend, or a feature plus a data…
chadixearth/graphyloop · integrations/claude-code/skills/graphyloop-workflow/SKILL.md · Use this skill at the start of any non-trivial coding task, build or multi-file change to follow GraphyLoop Workflow v3…
chadixearth/graphyloop · integrations/claude-code/skills/swarm-memory/SKILL.md · Use this skill at the start and end of every non-trivial task to recall and record durable project knowledge through…
chadixearth/graphyloop · skills/ai-video-prompt-engineer/SKILL.md · Use when the user wants to create AI video generation prompts for a brand, product, website, or topic. Includes…
chadixearth/graphyloop · skills/api-contract-design/SKILL.md · Use this skill when freezing the interface between a backend and its clients before parallel work starts, or when…
chadixearth/graphyloop · skills/api-hardening/SKILL.md · Use this skill when building or reviewing a server-side endpoint, route handler, server action, webhook, cron job, or…
chadixearth/graphyloop · skills/brainstorming/SKILL.md · You MUST use this before any creative work - creating features, building components, adding functionality, or modifying…
chadixearth/graphyloop · skills/cavecrew/SKILL.md · Decision guide for delegating to caveman-style subagents. Tells the main thread WHEN to spawn `cavecrew-investigator`…
chadixearth/graphyloop · skills/caveman-compress/SKILL.md · Compress natural language memory files (CLAUDE.md, todos, preferences) into caveman format to save input tokens…
thedaviddias/front-end-checklist · skills/error-handling/SKILL.md · Use when reviewing scripts, client components, bundles, or runtime behavior related to Implement proper error handling…
ericrisco/rsc-harness · skills/error-handling/SKILL.md · Use when designing the reaction to a class of failures — typed error taxonomies, retry/backoff/timeout policy, circuit…