🐛 fix(login.py): re-raise HTTPException if it is already raised to prevent overriding the original exception
This commit is contained in:
parent
c6882a0598
commit
12a46b6936
1 changed files with 2 additions and 0 deletions
|
|
@ -26,6 +26,8 @@ async def login_to_get_access_token(
|
||||||
try:
|
try:
|
||||||
user = authenticate_user(form_data.username, form_data.password, db)
|
user = authenticate_user(form_data.username, form_data.password, db)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
if isinstance(exc, HTTPException):
|
||||||
|
raise exc
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||||
detail=str(exc),
|
detail=str(exc),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue