Error Handling Patterns
Software development skill, available on Zeplik
Error Handling Patterns is a ready-to-run software development skill on Zeplik. Not for diagnosing a live bug (use systematic-debugging). Ask in plain language and Zeplik applies the skill's method for you inside the conversation, on whichever AI model you prefer.
The Error Handling Patterns skill loads automatically when your request matches it, or you can invoke it directly by typing /error-handling-patterns in any chat. It works with attachments, connectors, and any model that supports the task, so you get the same expert method every time without setting anything up.
What the Error Handling Patterns skill can do
- Review pasted code and map every failure point across I/O and calls
- Flag common pitfalls like broad catches and swallowed errors with line references
- Design a consistent typed error taxonomy and wrapping strategy
- Rewrite code with resilient retry, circuit breaker, and graceful degradation patterns
Try these prompts on Zeplik
Pick a prompt to open it in the Zeplik app. If you are not signed in yet, your prompt is waiting for you the moment you do.
How the Error Handling Patterns skill works
/error-handling-patterns
Build resilient applications with robust error handling that gracefully handles failures and gives excellent debugging signals. The user pastes code or describes a failure mode; deliver rewritten code, error taxonomy designs, and concrete recommendations as chat artifacts. For actively diagnosing a bug that is happening right now, use systematic-debugging.
When to Use
- Implementing error handling in new features
- Designing error-resilient APIs
- 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
1. Error Handling Philosophies
Exceptions vs Result Types:
- 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
When to Use Each:
- Exceptions: Unexpected errors, exceptional conditions
- Result Types: Expected errors, validation failures
- Panics/Crashes: Unrecoverable errors, programming bugs
2. Error Categories
Recoverable Errors: network timeouts, missing files, invalid user input, API rate limits.
Unrecoverable Errors: out of memory, stack overflow, programming bugs (null pointer, etc.).
Best Practices
- Fail Fast: Validate input early, fail quickly
- Preserve Context: Include stack traces, metadata, timestamps
- Meaningful Messages: Explain what happened and how to fix it
- Log Appropriately: Error = log, expected failure = don't spam logs
- Handle at Right Level: Catch where you can meaningfully handle
- Clean Up Resources: Use try-finally, context managers, defer
- Don't Swallow Errors: Log or re-throw, don't silently ignore
- Type-Safe Errors: Use typed errors when possible
# Good error handling example
def process_order(order_id: str) -> Order:
"""Process order with comprehensive error handling."""
try:
# Validate input
if not order_id:
raise ValidationError("Order ID is required")
# Fetch order
order = db.get_order(order_id)
if not order:
raise NotFoundError("Order", order_id)
# Process payment
try:
payment_result = payment_service.charge(order.total)
except PaymentServiceError as e:
# Log and wrap external service error
logger.error(f"Payment failed for order {order_id}: {e}")
raise ExternalServiceError(
f"Payment processing failed",
service="payment_service",
details={"order_id": order_id, "amount": order.total}
) from e
# Update order
order.status = "completed"
order.payment_id = payment_result.id
db.save(order)
return order
except ApplicationError:
# Re-raise known application errors
raise
except Exception as e:
# Log unexpected errors
logger.exception(f"Unexpected error processing order {order_id}")
raise ApplicationError(
"Order processing failed",
code="INTERNAL_ERROR"
) from e
Common Pitfalls
- Catching Too Broadly:
except Exceptionhides bugs - Empty Catch Blocks: Silently swallowing errors
- Logging and Re-throwing: Creates duplicate log entries
- Not Cleaning Up: Forgetting to close files, connections
- Poor Error Messages: "Error occurred" is not helpful
- Returning Error Codes: Use exceptions or Result types
- Ignoring Async Errors: Unhandled promise rejections
Review Workflow
When the user pastes code for an error-handling review:
- Map every failure point (I/O, external calls, parsing, concurrency).
- Flag pitfalls from the list above with line references.
- Propose a consistent error taxonomy for the module (typed errors, wrapping strategy).
- Deliver the rewritten code as a chat artifact plus a short rationale per change.
Detailed Patterns and Worked Examples
Language-specific patterns (Python, TypeScript, Rust, Go), retry/circuit breaker implementations, and API error response design live in references/details.md. Read that file when the navigation tier above is insufficient.
Usage
/error-handling-patterns $ARGUMENTS
How to use the Error Handling Patterns skill
Sign in to Zeplik
Create a free Zeplik account or sign in. New accounts start with free credits, so you can try the Error Handling Patterns skill right away.
Describe your software development task
Ask in plain language, or type /error-handling-patterns to invoke the skill directly. Zeplik recognizes the Error Handling Patterns skill and applies its method.
Review and refine the result
Zeplik returns a clear, structured answer. Ask follow-ups in the same chat to refine it or take the next step.
Source and credit
- Author
- wshobson
- License
- MIT
Adapted from the open-source wshobson/agents project and tuned to run natively on Zeplik. View source on GitHub.
Frequently asked questions
- What is the Error Handling Patterns skill?
- Error Handling Patterns is a ready-to-run software development skill on Zeplik. Not for diagnosing a live bug (use systematic-debugging). Ask in plain language and Zeplik applies the skill's method for you inside the conversation, on whichever AI model you prefer.
- How do I use Error Handling Patterns on Zeplik?
- Sign in to Zeplik and ask in plain language, or type /error-handling-patterns in any chat to invoke it directly. The skill applies its method and returns a result you can refine in the same conversation.
- Which AI model does the Error Handling Patterns skill use?
- Any model you choose. Zeplik works across every model in one chat, so the Error Handling Patterns skill runs on your preferred model for the task.
- Where does the Error Handling Patterns skill come from?
- The Error Handling Patterns skill is adapted from the open-source wshobson/agents project (MIT) and tuned to run natively on Zeplik. The original source is linked on this page.
- How much does the Error Handling Patterns skill cost?
- Using the skill is free to start. You only spend Zeplik credits when the assistant runs, and new accounts begin with free credits.
Related software development skills
- .NET BackendBuild ASP.NET Core 8+ backends with EF Core: auth, background jobs, production API patterns
- Advanced Git WorkflowsUse for advanced Git surgery: interactive rebase, cherry-pick, bisect, reflog recovery, and history cleanup before merging. Not for parallel worktree workflows (use using-git-worktrees).
- Adversarial Code ReviewHunt for bugs in code the user shares by assuming defects exist and attacking the code through several distinct lenses, then report severity-ranked findings with evidence. Use for "review this", "what could go wrong", "bug hunt", or pre-merge scrutiny of a change. Read-only, it reports problems and does not rewrite the code. Not for style cleanup (use simplify-code) or for writing new code.
- AI Agent FrameworksUse when building multi-agent systems or agent orchestration -- LangChain/LangGraph, agent team design, task coordination, pipelines. Not for authoring a Zeplik skill (use skill-creator).
- Algolia SearchAdd Algolia search: indexing strategies, React InstantSearch, relevance tuning, search-as-you-type
- Android CI/CDAutomate Android CI/CD to Google Play: keystore, GitHub Secrets, multi-stage release workflow for RN, Flutter, native
More on Zeplik
Try Error Handling Patterns on Zeplik
Every model, one chat. Bring the Error Handling Patterns skill into your next conversation and let the assistant do the work.