fix(proxy_server.py): don't override exceptions if they're of type httpexception

This commit is contained in:
Krrish Dholakia 2023-12-05 14:33:28 -08:00
parent 8b9206ae51
commit 4328a66a3a

View file

@ -279,6 +279,9 @@ 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()}")
if isinstance(e, HTTPException):
raise e
else:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="invalid user key",