🐛 fix(login.py): re-raise HTTPException if it is already raised to prevent overriding the original exception

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-25 22:09:46 -03:00
commit 12a46b6936

View file

@ -26,6 +26,8 @@ async def login_to_get_access_token(
try:
user = authenticate_user(form_data.username, form_data.password, db)
except Exception as exc:
if isinstance(exc, HTTPException):
raise exc
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=str(exc),