What are the exception anti-patterns that cause silent failures in production?
⚡ 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.
☕Coffee Chat Question
Concept Made Simple
“What are the exception anti-patterns that cause silent failures in production?”
🧠Mind Map Answer
Remember It Faster
⌨️Hands-on Keyboard
Learn by Doing
// BAD
try { pay(); } catch (Exception e) { } // swallowed
// GOOD
try { pay(); }
catch (PaymentException e) {
throw new OrderFailedException("pay failed for " + id, e); // keep cause
}🔥What If?
Think Beyond the Expected
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:
⚠️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
- 1Where should you log vs rethrow in a layered app?
- 2How do correlation/trace ids help across microservices?
- 3Why is catching Throwable especially dangerous?
🧩Related Technologies
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?
⭐ Featured Products
Support our platform by exploring our recommended products.
As an Amazon affiliate, purchases through these links may earn us a small commission — at no extra cost to you. It helps keep Full Stack Interview Guru free.