gh-134262: Catch both URLError and ConnectionError in retries (#135365)

This commit is contained in:
Emma Smith 2025-06-17 07:51:23 -04:00 committed by GitHub
parent 0d582def34
commit acc20a83f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -172,7 +172,7 @@ def download_with_retries(download_location: str,
for attempt in range(max_retries + 1):
try:
resp = urllib.request.urlopen(download_location)
except urllib.error.URLError as ex:
except (urllib.error.URLError, ConnectionError) as ex:
if attempt == max_retries:
msg = f"Download from {download_location} failed."
raise OSError(msg) from ex