OhMyBug

logic/correctness

Catch Targets Exception Never Thrown

#92rare6 sightingsfirst seen September 2026

What goes wrong

An error handler catches an exception type from one library's hierarchy, but the code that fails throws an untranslated type from another library. The handler is dead in production; only a test that throws the handler's own type ever reaches it.

Example

The code catches the database driver's exception, but the data-access layer wraps everything in its own exception type, so the retry-on-deadlock branch never runs.

Not to be confused with

A type mismatch between catcher and thrower; not a swallowed cancellation (Swallowed Cancellation) and not a broad catch that discards details (Discarded Failure Diagnostics).

Discovered by

Field notes · 3