Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lightllm/utils/error_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ServerBusyError(Exception):
"""Custom exception for server busy/overload situations"""

def __init__(self, message="Server is busy, please try again later", status_code=429):
def __init__(self, message="Too many requests. Please try again later.", status_code=429):
"""
Initialize the ServerBusyError

Expand All @@ -21,7 +21,7 @@ def __init__(self, message="Server is busy, please try again later", status_code

def __str__(self):
"""String representation of the error"""
return f"{self.message} (Status code: {self.status_code})"
return self.message


class ClientDisconnected(Exception):
Expand Down
3 changes: 2 additions & 1 deletion test/test_api/test_server_busy_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_server_busy_response_is_rate_limited(monkeypatch):
body = json.loads(response.body)

assert response.status_code == 429
assert body["error"]["message"] == "Too many requests. Please try again later."
assert body["error"]["type"] == "RateLimitError"
assert body["error"]["code"] == 429
assert metric_client.counters == ["lightllm_request_failure"]
Expand Down Expand Up @@ -158,7 +159,7 @@ async def run():
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "Server is busy, please try again later (Status code: 429)",
"message": "Too many requests. Please try again later.",
},
}
assert metric_client.counters == ["lightllm_request_failure"]
Expand Down
Loading