Wrap additional network errors in factor download
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import http.client
|
||||
import io
|
||||
import socket
|
||||
import ssl
|
||||
@@ -35,7 +36,16 @@ def _download_kf_zip_bytes() -> bytes:
|
||||
try:
|
||||
with urlopen(request, timeout=30) as response:
|
||||
return response.read()
|
||||
except (URLError, TimeoutError, ConnectionError, socket.timeout, ssl.SSLError) as exc:
|
||||
except (
|
||||
URLError,
|
||||
TimeoutError,
|
||||
ConnectionError,
|
||||
socket.timeout,
|
||||
socket.gaierror,
|
||||
ssl.SSLError,
|
||||
http.client.IncompleteRead,
|
||||
http.client.RemoteDisconnected,
|
||||
) as exc:
|
||||
raise ExternalFactorDownloadError(f"Failed to download external factor data: {exc}") from exc
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user