mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
fix(proxy): set num_retries/max_retries on ProxyHTTPRateLimitError
ProxyHTTPRateLimitError inherits from RateLimitError but did not call RateLimitError.__init__, so num_retries/max_retries were never set. When Starlette's HTTPException lacks __str__, MRO falls through to RateLimitError.__str__, which unconditionally reads these attributes and raises AttributeError during logging/traceback formatting. Initialize them to None defensively.
This commit is contained in:
parent
21ccf565e3
commit
af811ec81e
1 changed files with 6 additions and 0 deletions
|
|
@ -94,6 +94,12 @@ class ProxyHTTPRateLimitError(HTTPException, RateLimitError):
|
|||
# `message` is what RateLimitError.__str__ would print and what some
|
||||
# observability callbacks log. Keep it human-readable.
|
||||
self.message = detail if isinstance(detail, str) else str(detail)
|
||||
# `RateLimitError.__str__` (resolved via MRO since Starlette's
|
||||
# HTTPException doesn't define `__str__`) unconditionally reads
|
||||
# these attributes. Set them so `str(exc)` doesn't raise
|
||||
# AttributeError from logging/traceback paths.
|
||||
self.num_retries: Optional[int] = None
|
||||
self.max_retries: Optional[int] = None
|
||||
|
||||
|
||||
def convert_priority_to_percent(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue