Skip to content

Commit

Permalink
fix(proxy_server.py): don't override exceptions if they're of type ht…
Browse files Browse the repository at this point in the history
…tpexception
  • Loading branch information
krrishdholakia committed Dec 5, 2023
1 parent c717ed4 commit 4d7ff1b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions litellm/proxy/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,13 @@ async def user_api_key_auth(request: Request, api_key: str = fastapi.Security(ap
raise Exception(f"Invalid token")
except Exception as e:
print(f"An exception occurred - {traceback.format_exc()}")
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="invalid user key",
)
if isinstance(e, HTTPException):
raise e
else:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="invalid user key",
)

def prisma_setup(database_url: Optional[str]):
global prisma_client
Expand Down

0 comments on commit 4d7ff1b

Please sign in to comment.