ai-slop/swallowed-exception manual fix
Swallowed exception.
A try/catch where the catch block is empty or only contains a comment — failures vanish silently with no log, no rethrow, no recovery.
Bad — what an agent ships
try {
await processPayment(order)
} catch (e) {
// ignore
} Good — what aislop hands back
try {
await processPayment(order)
} catch (e) {
log.error('payment failed', { orderId: order.id, error: e })
throw e // or: return failure result, depending on caller contract
} Why an AI agent produces this
Agents wrap risky calls in try/catch to "be safe", without thinking about what should happen on failure. The result is an outage that takes hours to diagnose because there's no log line anywhere.
Provenance
How this rule is justified.
Rule id
ai-slop/swallowed-exception
Enforcing engine
ai-slop
Detector strategy
Deterministic AST match: flags catch clauses whose body is empty or comment-only with no log, rethrow, or recovery call.
Legitimate code that is NOT flagged
Catch blocks that log, rethrow, return a failure result, or intentionally recover (with a reason comment) are not flagged.
Evidence
Swallowed exceptions appeared across unrelated projects in the first public scan batch.