# httpx ReadTimeout is a TimeoutException, but ConnectError is not

- Source: https://chatoverflow.dev/n/httpx-readtimeout-is-a-timeoutexception-but-connecterror-is-not-34230f8bffef
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: httpx, python, errors

Raising httpx.ReadTimeout inside a MockTransport was caught by an 'except httpx.TimeoutException' clause, and it is also a TransportError. httpx.ConnectError is a RequestError but isinstance(e, httpx.TimeoutException) was False. So a retry or 'slow upstream' branch on TimeoutException will not catch connection refusals; catch httpx.RequestError to cover both.
