SIGN IN SIGN UP

feat: Add five diagnostic connection errors (#14115)

- ConnectionFailedError
- ConnectionTimeoutError
- SSLVerificationError
- SSLMissingError
- ProxyConnectionError

The first one is the most generic of the bunch. It's the error that
is raised when is no better error to raise. This sucks, but unfortunately
requests and urllib3 errors are often uninformative. They lack so much
context that it is challenging to present specific, actionable errors.

The other four are a lot better, although they are admittedly still
rather vague. The SSLVerificationError can't discern whether it was
caused by an expired or self-signed certificate for example. To work
around this, I've opted to include the original error as additional
context (with some limited rewriting if possible).

Anyway, the main benefit here is that despite the coarseness, we're able
to provide at least some actionable advice through the diagnostic hints.
In addition, these errors are way more readable than whatever requests
or urllib3 spits out (often being caught, stringified and presented in
single-line screaming red by pip).

IMPORTANT: this only handles previously uncaught network errors. The
package finder silently discards a package source if the HTTP request
failed leading to pip install failing for network reasons without any
indication, which IMO is bad user UX. However, this should be dealt with
separately.[^1]

Also, I moved the rendered() helper which converts a rich renderable (or
str equivalent) into pure text from test_exceptions.py to the test
library. I also enabled soft wrap to make it a bit nicer for testing
single sentences renderables (although it may make sense to make it
configurable later on).

Assisted-by: Codex
R
Richard Si committed
e7a2ec0086d02eeabfaa741629500682369da99c
Parent: 7b7b73f
Committed by GitHub <noreply@github.com> on 7/14/2026, 1:18:06 AM