From ce
Guides error handling best practices to prevent silent failures, preserve context, and log effectively in try-catch blocks, propagation, and Result patterns.
npx claudepluginhub rileyhilliard/claude-essentials --plugin ceThis skill uses the workspace's default tool permissions.
1. **Never swallow errors** - Empty catch blocks hide bugs that surface later in unrelated places, making them much harder to trace
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.
Every error message answers: What happened? Why? How to recover?
For logs (developers):
logger.error("Failed to save user: Connection timeout after 30s", {
userId: user.id,
dbHost: config.db.host,
error: error.stack,
});
For users:
For user-facing error copy, use Skill(ce:writer) with The UX Writer persona. Key principles:
showError({
title: "Upload failed",
message: "File exceeds 10MB limit. Choose a smaller file.",
actions: [{ label: "Choose file", onClick: selectFile }],
});
| Type | Examples | Handling |
|---|---|---|
| Expected | Validation, Not found, Unauthorized | Return Result type, log info |
| Transient | Network timeout, Rate limit | Retry with backoff, log warn |
| Unexpected | Null reference, DB crash | Log error, show support ID |
| Critical | Auth down, Payment gateway offline | Circuit breaker, alert |
Fail fast for critical dependencies:
await connectToDatabase(); // Throws on failure - app can't run without it
Degrade gracefully for optional features:
const prefs = await loadPreferences(userId).catch(() => DEFAULT_PREFS);
// ❌ Logging at every layer = same error 3x
async function fetchData() {
try { return await fetch(url); }
catch (e) { console.error("Fetch failed:", e); throw e; }
}
// ✅ Log once where handled
async function fetchData() {
const response = await fetch(url);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return response;
}
// Top level logs the error once
| Pattern | Problem | Fix |
|---|---|---|
| Empty catch blocks | Hides errors | Log or re-throw |
return false on error | Loses context | Return Result type |
| Generic "Error" messages | Undebuggable | Include what/why/context |
| Logging same error at each layer | Log pollution | Log once at boundary |
Bare except: / catch (e) all | Catches system signals | Catch specific types |