Skip to content

Commit 16f8bbe

Browse files
committed
Common exceptions
1 parent e89da1f commit 16f8bbe

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

brood/middleware.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ async def get_current_user(
2828
token_object = actions.get_token(session=db_session, token=token)
2929
except actions.TokenNotFound:
3030
raise HTTPException(status_code=404, detail="Access token not found")
31+
except Exception:
32+
raise HTTPException(status_code=500)
3133
if not token_object.active:
3234
raise HTTPException(status_code=403, detail="Token has expired")
3335
return token_object.user
@@ -120,4 +122,6 @@ async def is_token_restricted(
120122
token_object = actions.get_token(session=db_session, token=token)
121123
except actions.TokenNotFound:
122124
raise HTTPException(status_code=404, detail="Access token not found")
125+
except Exception:
126+
raise HTTPException(status_code=500)
123127
return token_object.restricted

0 commit comments

Comments
 (0)