From coding-agent
Error handling patterns for consistent, meaningful error management across the stack. Use when implementing any feature that can fail.
npx claudepluginhub devjarus/coding-agentThis skill uses the workspace's default tool permissions.
- **Errors are expected, not exceptional.** Network calls fail. Users provide invalid input. Disks fill up. Treat failures as a normal part of the flow.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
catch block that continues execution as if nothing happened is a bug waiting to surface in production.System boundaries are where external data enters your system: HTTP requests, message queue consumers, CLI arguments, file uploads.
{ "error": "VALIDATION_FAILED", "field": "email", "message": "must be a valid email address" }
Business logic is the core of your application. Errors here are domain events, not infrastructure surprises.
Error tells the caller nothing. InsufficientFundsError, OrderAlreadyShippedError, and UserNotFoundError convey meaning and can be handled selectively.throw new PaymentProcessingError("failed to charge card", { cause: originalError, orderId })
Infrastructure code talks to databases, external APIs, message queues, and file systems. These components fail transiently.
Avoid these patterns — they make bugs harder to find and production incidents harder to diagnose.
| Anti-pattern | Why it's harmful |
|---|---|
| Empty catch block | Silently discards the error. The program continues in an invalid state. |
| Catch-and-rethrow without context | Loses the original error message and stack trace. |
Returning null or undefined for failure | Forces every caller to remember to check, and they often won't. |
| Log-and-throw | Produces duplicate log entries and confusing stack traces. Log or throw, not both. |
| Generic error messages | "Something went wrong" is not actionable for users or on-call engineers. |
Catching Error to ignore specific errors | Catches too broadly; suppresses unexpected errors alongside the expected one. |