Skip to main content
New aislop v0.13.1 patch — calibrates hidden-fallback detection and fixes regex comment-masker false positives. Read the changelog →
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.

Flagged shape and clean shape.

Each example shows the exact code shape the rule is looking for, then the smallest version that keeps the intent without hiding risk or adding noise.

Flagged example
try {
  await processPayment(order)
} catch (e) {
  // ignore
}
Why this trips

Deterministic AST match: flags catch clauses whose body is empty or comment-only with no log, rethrow, or recovery call.

Clean example
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
}
What changed

Make the failure observable or handled. Log useful context and rethrow, return a typed failure result, or perform a real recovery path with a reason the next maintainer can audit.

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.