Empty Catch Finder
Scannednpx machina-cli add skill dcs-soni/awesome-claude-skills/empty-catch-finder --openclawEmpty Catch Block Finder
Detect silent error handlers that cause mysterious production failures.
Why This Matters
Empty catch blocks are silent killers:
try {
await saveOrder(order);
} catch (e) {
// Silent failure - order lost, no evidence
}
This skill finds them before they cause production incidents.
Quick Start
Empty Catch Analysis:
- [ ] Step 1: Scan for empty catch blocks
- [ ] Step 2: Assess risk level
- [ ] Step 3: Generate fix suggestions
Workflow
Step 1: Scan for Empty Catches
Find all empty/silent catch blocks:
python scripts/find_empty_catches.py <directory>
Detects:
catch (e) {}- completely emptycatch (e) { /* comment */ }- only commentsexcept: pass- Python silent passif err != nil { }- Go ignored errorscatch { return; }- silent returns
Step 2: Assess Risk Level
Each catch is categorized by risk:
| Risk | Pattern | Why Dangerous |
|---|---|---|
| š“ Critical | Empty catch in async/database code | Data loss, corruption |
| š High | Empty catch in API handlers | Silent failures to users |
| š” Medium | Empty catch in utilities | Hidden bugs |
| š¢ Low | Empty catch in tests/scripts | Usually intentional |
Step 3: Generate Fix Suggestions
Get suggested fixes:
python scripts/generate_fixes.py <directory> --output fixes.md
Fix patterns:
// ā Before: Silent failure
catch (e) {}
// ā
After: Logged + handled
catch (e) {
logger.error('Order save failed', { error: e, orderId: order.id });
throw new OrderSaveError('Failed to save order', { cause: e });
}
Utility Scripts
| Script | Purpose |
|---|---|
find_empty_catches.py | Find empty catch blocks |
generate_fixes.py | Suggest proper error handling |
Language Support
| Language | Patterns Detected |
|---|---|
| JavaScript/TypeScript | catch (e) {}, catch {} |
| Python | except: pass, except Exception: ... |
| Java | catch (Exception e) {} |
| Go | if err != nil { } (empty body) |
| C# | catch (Exception) {} |
See PATTERNS.md for full pattern reference.
Example
User: "Find silent error handlers in my codebase"
Output:
Found 8 empty catch blocks
š“ CRITICAL (2)
src/services/payment.ts:45
catch (e) {} // In async payment processing!
src/db/users.ts:112
catch (e) { return null; } // Hides DB errors
š HIGH (3)
src/api/orders.ts:78
catch (error) { /* TODO: handle */ }
...
Integration with Linting
After fixing, prevent new empty catches:
ESLint:
{ "rules": { "no-empty": ["error", { "allowEmptyCatch": false }] } }
Python (Ruff):
[tool.ruff]
select = ["E722"] # bare-except
Related Skills
- incident-response-helper ā Debug issues caused by silent failures
- stale-todo-finder ā Find
// TODO: handle errorcomments
Source
git clone https://github.com/dcs-soni/awesome-claude-skills/blob/main/empty-catch-finder/SKILL.mdView on GitHub Overview
Empty Catch Block Finder detects silent error handlers that swallow exceptions, helping teams prevent production incidents and hidden bugs. It targets mentions of silent failures, empty catches, ignored exceptions, or debugging mysterious issues.
How This Skill Works
The workflow scans code for empty or silent catches, classifies each finding by risk, and then generates practical fixes. It mirrors the skill's steps: Step 1 Scan for Empty Catches, Step 2 Assess Risk Level, Step 3 Generate Fix Suggestions.
When to Use It
- When you suspect silent failures or missing error reporting in production
- When debugging mysterious production issues caused by error swallowing
- During code reviews to enforce proper error handling
- When refactoring legacy code with empty catch blocks
- When integrating linting to prevent empty catches from reappearing
Quick Start
- Step 1: Scan for empty catch blocks
- Step 2: Assess risk level
- Step 3: Generate fix suggestions
Best Practices
- Scan codebases regularly for empty catches
- Prioritize riskier paths like async or API handlers
- Log errors and rethrow or wrap with meaningful messages
- Avoid catch blocks that simply return or swallow errors
- Add tests that exercise error paths and verify handling
Example Use Cases
- catch (e) {} // Silent failure ā order could be lost
- catch (e) { return null; } // Hides DB errors
- catch (error) { /* TODO: handle */ } // Missing implementation
- if err != nil { } // Go: ignored error
- except: pass // Python silent pass