Swallowed Exception

Swallowed Exception image
A swallowed exception, also described as a swallowed root cause, is an error that is caught in code and then hidden or replaced with a vague message, so the real reason for the failure is lost. Users typically see something generic such as "Something went wrong" or "Check-in failed" instead of what actually caused the problem.

Why it matters: Swallowing errors is one of the most common error handling mistakes. It leaves users with no idea what to do next and makes problems slower to diagnose, which hurts recovery time. It can also damage team culture: when detailed messages from lower-level modules are always suppressed, developers stop bothering to write useful ones.

In practice: Exceptions usually carry a plain-language message plus a link to the earlier exception that caused them. Swallowing happens when a catch block throws a new, generic error and drops the detail, often out of worry that the precise message will be too technical. Better approaches:

  • Pass user-friendly detail upwards, building a message from general to specific.
  • Keep the full chain of causes in logs for support and developers.
  • Test failure paths deliberately to see what users actually get.

Examples:

  • A check-in flow that runs identity, age, visa and payment checks but only ever reports "Check-in failed", whichever step broke.
  • An improved version that reports "Check-in failed because the visa could not be verified".
  • A catch block that logs nothing and returns an empty result, so a failure looks like a success.

Common pitfalls:

  • Assuming users cannot cope with any technical detail, when many understand more than expected, including error codes.
  • Replacing a swallowed error with a misleading one, such as "Try again later" for a request that will never succeed.

How can testers spot swallowed exceptions? Trigger failures in different parts of a flow and compare the messages. If very different causes all produce the same generic message, the root cause is probably being swallowed.

Is a swallowed exception a bug? It is usually treated as a quality issue worth reporting, because it slows diagnosis and leaves users without useful guidance.
Explore MoT
Test Forward 2027 ยท Software Quality in the age of AI image
Tue, 19 Jan 2027
Test Forward is one afternoon at Station F with the QA and engineering people closing that gap in their own teams.
Bug Reporting 101 image
A quick course on raising bugs
Into The Motaverse image
Into the MoTaverse is a podcast by Ministry of Testing, hosted by Rosie Sherry, exploring the people, insights, and systems shaping quality in modern software teams.
Subscribe to our newsletter