Skip to content

Commit c7f099d

Browse files
committed
fix: check str(exc) instead of http_response.text for retryable phrases
1 parent 14bc124 commit c7f099d

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

tests/base.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,11 @@ def _is_retryable_error(exc: Exception) -> bool:
5454
if isinstance(exc, AssertionError):
5555
return True
5656
if isinstance(exc, StreamAPIException):
57-
if exc.status_code == 429:
57+
if exc.status_code in (429, 502, 503, 504):
5858
return True
59-
if exc.status_code in (502, 503, 504):
60-
return True
61-
body = ""
62-
try:
63-
body = exc.http_response.text or ""
64-
except Exception:
65-
pass
66-
lowered = body.lower()
59+
msg = str(exc).lower()
6760
if any(
68-
phrase in lowered
61+
phrase in msg
6962
for phrase in (
7063
"upstream connect error",
7164
"disconnect",

0 commit comments

Comments
 (0)