Skip to content

Commit 3ff1196

Browse files
Fix some oddities in the client (#562)
1 parent 72a2b5a commit 3ff1196

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clients/python/llmengine/errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def parse_error(status_code: int, content: bytes) -> Exception:
8181
try:
8282
payload = json.loads(content)
8383
message = payload["detail"]
84-
except json.JSONDecodeError:
84+
except (json.JSONDecodeError, KeyError):
8585
message = content.decode("utf-8")
8686

8787
# Try to parse a APIInference error
@@ -93,7 +93,7 @@ def parse_error(status_code: int, content: bytes) -> Exception:
9393
return NotFoundError(message)
9494
if status_code == 429:
9595
return RateLimitExceededError(message)
96-
if 600 < status_code <= 500:
96+
if 500 <= status_code < 600:
9797
return ServerError(status_code, message)
9898

9999
# Fallback to an unknown error

0 commit comments

Comments
 (0)