Skip to content

is_connection_error

Function: warmhub.is_connection_error

is_connection_error(error: object)

Whether error is a connection-level failure raised before a response.

Ports isConnectionError. The TypeScript version detects TypeError('fetch failed') and Bun’s errno-coded Error; the Python analogue detects the stdlib connection exceptions, httpx’s pre-connection exception classes and their subclasses, and the same errno code set.

Deliberately narrower than is_transport_error: read and write failures and read timeouts are excluded, because the server did produce a connection and TypeScript classifies a 408 as not a connection failure either. Both answers are NETWORK in the end; the split exists so the transport can attach the message that actually describes what happened.