What are the exception anti-patterns that cause silent failures in production?
Reviewed by Gurusankar M.
Short Answer
Swallowing exceptions (empty catch), catching Exception/Throwable too broadly, losing the cause when re-wrapping, logging-and-rethrowing (double logs), and using exceptions for control flow. Each hides root cause or floods logs.
On this page
Concept Made Simple
Coffee Chat Question
“What are the exception anti-patterns that cause silent failures in production?”
Remember It Faster
Mind Map Answer
- Swallow
- catch {} → invisible failure
- Too broad
- catch (Exception) hides bugs
- Lost cause
- throw new X() without e
- Log+rethrow
- duplicate noise
Learn by Doing
Hands-on Keyboard
// BAD
try { pay(); } catch (Exception e) { } // swallowed
// GOOD
try { pay(); }
catch (PaymentException e) {
throw new OrderFailedException("pay failed for " + id, e); // keep cause
}Think Beyond the Expected
What If?
A request fails but the logs show nothing — most likely cause?
A swallowed exception (empty catch) or a catch that logs at DEBUG/returns null. The fix: never swallow; log at the right level once, at the boundary, with the full stack trace and a correlation id.
Real World
The hardest production incidents to debug are the ones with empty catch blocks — the failure happened, but there's no trace, so you're blind. Log-once-at-the-edge with correlation ids is the cure.
Interviewer's Expectation
Keywords they're listening for:
- never swallow
- catch narrowly
- preserve cause
- log once at boundary
- correlation id
Common Mistakes
- Empty catch blocks
- throw new RuntimeException(e.getMessage()) — drops the stack
- Logging and rethrowing the same exception repeatedly
Best Practices
- Log once at the boundary with the full cause + correlation id
- Catch the most specific type
- Wrap with the cause; fail fast on programming errors
Follow-up Questions
- Where should you log vs rethrow in a layered app?
- How do correlation/trace ids help across microservices?
- Why is catching Throwable especially dangerous?
Continue Learning with AI
Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly — AI is your learning companion, not a shortcut.
Plain-language foundations
I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner. Topic: Exceptions (Core Java) Interview question: "What are the exception anti-patterns that cause silent failures in production?" Please: 1. Explain the core idea in simple, plain language, using an everyday analogy. 2. Define any technical terms you use. 3. Walk through one small, concrete example. 4. Finish with a single sentence I can easily remember. Keep the tone friendly and assume I'm new to this topic.
Was this answer helpful?
Affiliate links
Tools for Your Developer Workspace
Equipment for a comfortable, productive setup.
As an Amazon Associate I earn from qualifying purchases.
- MonitorView on Amazon : BenQ EW2790U 27-inch Monitor (opens in a new tab)
BenQ EW2790U 27-inch Monitor
- LaptopView on Amazon : Acer Aspire One Laptop (opens in a new tab)
Acer Aspire One Laptop
- Office ChairView on Amazon : Wakefit Gravita Ergonomic Office Chair (opens in a new tab)
Wakefit Gravita Ergonomic Office Chair