From d3532d7d6f84d410e4be0efb9cb61a4b60f08b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Sch=C3=A4fer?= Date: Fri, 28 Nov 2025 17:25:54 -0800 Subject: [PATCH] URLFile: catch more (#36712) * catch * linter has a point --- tools/lib/url_file.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/lib/url_file.py b/tools/lib/url_file.py index 31c1e0ff11..f988fa9db1 100644 --- a/tools/lib/url_file.py +++ b/tools/lib/url_file.py @@ -6,6 +6,8 @@ from hashlib import sha256 from urllib3 import PoolManager, Retry from urllib3.response import BaseHTTPResponse from urllib3.util import Timeout +from urllib3.exceptions import MaxRetryError + from openpilot.common.utils import atomic_write_in_dir from openpilot.system.hardware.hw import Paths @@ -61,7 +63,10 @@ class URLFile: pass def _request(self, method: str, url: str, headers: dict[str, str] | None = None) -> BaseHTTPResponse: - return URLFile.pool_manager().request(method, url, timeout=self._timeout, headers=headers) + try: + return URLFile.pool_manager().request(method, url, timeout=self._timeout, headers=headers) + except MaxRetryError as e: + raise URLFileException(f"Failed to {method} {url}: {e}") from e def get_length_online(self) -> int: response = self._request('HEAD', self._url)