A conversation I have had dozens of times in code reviews:
Me: Why are you catching this exception here?
Developer: Otherwise the app would crash.
Me: That is what we want.
The reaction is always the same. Confusion. Sometimes mild offense.
But I mean it.
An exception means your application hit a state it did not expect. If you catch it and let execution continue, the app is now running in undefined territory. You just removed the only signal that something was wrong.
The question I always ask next: What does your app do after it catches this?
Usually the answer is: it keeps going. Maybe logs a warning. But no actual recovery. No re-check. No fix. Just continue.
That is not resilience. That is debt accumulating silently.
The alternative is not complicated:
– Set up a global exception handler that catches everything, logs it fully, and then lets the app terminate
– Add defensive validation at every boundary you do not control (APIs, databases, IO)
– Catch only when you have a specific, known exception and a deliberate response
Stability is not built by catching more. It is built by failing loudly and fixing the real cause.
What is the worst bug you have tracked down that turned out to be a swallowed exception?