This commit is contained in:
Prashant Sharma 2023-11-20 18:40:48 -05:00 committed by GitHub
commit dbadea3f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

1
news/5380.bugfix Normal file
View File

@ -0,0 +1 @@
Raise user friendly errors on network failures

View File

@ -1,6 +1,7 @@
from typing import Dict, Generator
from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
from pip._vendor.urllib3.exceptions import NewConnectionError, ReadTimeoutError
from pip._internal.exceptions import NetworkConnectionError
@ -94,3 +95,8 @@ def response_chunks(
if not chunk:
break
yield chunk
except (NewConnectionError, ReadTimeoutError) as exc:
raise NetworkConnectionError(
"Failed to get address for host! Check your network connectivity "
"and DNS settings.\nDetails: {}".format(exc)
)