forked from phoenix/litellm-mirror
Merge pull request #3910 from BerriAI/litellm_fix_end_user_max_budget
fix(proxy_server.py): fix end user object check when master key used
This commit is contained in:
commit
67973e5344
5 changed files with 92 additions and 3 deletions
|
@ -722,6 +722,8 @@ async def user_api_key_auth(
|
|||
budget_info.max_budget
|
||||
)
|
||||
except Exception as e:
|
||||
if isinstance(e, litellm.BudgetExceededError):
|
||||
raise e
|
||||
verbose_proxy_logger.debug(
|
||||
"Unable to find user in db. Error - {}".format(str(e))
|
||||
)
|
||||
|
@ -1410,6 +1412,10 @@ async def user_api_key_auth(
|
|||
raise Exception()
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
if isinstance(e, litellm.BudgetExceededError):
|
||||
raise ProxyException(
|
||||
message=e.message, type="auth_error", param=None, code=400
|
||||
)
|
||||
if isinstance(e, HTTPException):
|
||||
raise ProxyException(
|
||||
message=getattr(e, "detail", f"Authentication Error({str(e)})"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue