forked from phoenix/litellm-mirror
fix(proxy_server.py): don't override exceptions if they're of type httpexception
This commit is contained in:
parent
c717ed4d05
commit
4d7ff1b33b
1 changed files with 7 additions and 4 deletions
|
@ -279,10 +279,13 @@ async def user_api_key_auth(request: Request, api_key: str = fastapi.Security(ap
|
||||||
raise Exception(f"Invalid token")
|
raise Exception(f"Invalid token")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An exception occurred - {traceback.format_exc()}")
|
print(f"An exception occurred - {traceback.format_exc()}")
|
||||||
raise HTTPException(
|
if isinstance(e, HTTPException):
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
raise e
|
||||||
detail="invalid user key",
|
else:
|
||||||
)
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
detail="invalid user key",
|
||||||
|
)
|
||||||
|
|
||||||
def prisma_setup(database_url: Optional[str]):
|
def prisma_setup(database_url: Optional[str]):
|
||||||
global prisma_client
|
global prisma_client
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue