Skip to main content
New aislop v0.9.4: four new Python rules from the SlopCodeBench paper, plus a CLI star prompt and GitHub Discussions. Read more →
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
}

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.

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.