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.
β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.