FIX / Hub: Also catch for exceptions.ConnectionError (#31469)

* Update hub.py

* Update errors

* Apply suggestions from code review

Co-authored-by: Lucain <lucainp@gmail.com>

---------

Co-authored-by: Amy Roberts <22614925+amyeroberts@users.noreply.github.com>
Co-authored-by: Lucain <lucainp@gmail.com>
This commit is contained in:
Younes Belkada 2024-08-22 17:29:21 +04:00 committed by GitHub
parent 8b94d28f97
commit eeea71209a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -660,7 +660,14 @@ def has_file(
proxies=proxies,
timeout=10,
)
except OfflineModeIsEnabled:
except (requests.exceptions.SSLError, requests.exceptions.ProxyError):
# Actually raise for those subclasses of ConnectionError
raise
except (
requests.exceptions.ConnectionError,
requests.exceptions.Timeout,
OfflineModeIsEnabled,
):
return has_file_in_cache
try: