From claude-resources
Error handling strategy and decision framework. Use when designing error types, propagation patterns, or reviewing error handling. Pair with language-specific error-handling skill.
npx claudepluginhub deandum/claude-resources --plugin go-skillsThis skill uses the workspace's default tool permissions.
Errors are values. Handle them gracefully, not just check them.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides agent creation for Claude Code plugins with file templates, frontmatter specs (name, description, model), triggering examples, system prompts, and best practices.
Errors are values. Handle them gracefully, not just check them.
<lang>/error-handling skill)Ask in order:
Caller needs to programmatically distinguish this error?
Error is a static condition with no runtime data?
Error carries structured data the caller needs?
| Category | When | Example |
|---|---|---|
| Sentinel errors | Well-known conditions, multiple callers branch on it | NotFound, AlreadyExists, Forbidden |
| Custom error types | Caller needs structured data (field, code, resource) | ValidationError, NotFoundError |
| Wrapped errors | Default — add context as you propagate up | "finding user %s: %w" |
| Multi-error | Operation fails in multiple independent ways | Config validation, batch processing |
Map domain errors to transport responses at the boundary only. Domain code stays transport-agnostic.
| Domain Error | HTTP | gRPC | CLI Exit |
|---|---|---|---|
| NotFound | 404 | NOT_FOUND | 3 |
| Validation | 400/422 | INVALID_ARGUMENT | 2 |
| Conflict | 409 | ALREADY_EXISTS | 1 |
| Forbidden | 403 | PERMISSION_DENIED | 4 |
| Internal | 500 (log, return generic) | INTERNAL | 1 |
| Shortcut | Reality |
|---|---|
| "Just return the error" | Bare returns lose context. Callers can't diagnose without wrapping. |
| "Log it and return it" | Causes duplicate logging. Pick one: log OR return with context. |
| "Panic is simpler" | Panic crashes the process. Reserve for true programmer bugs only. |
| "String matching is fine" | Strings are fragile. Use typed/value error checking — strings break on rewording. |