Skip to content

Commit

Permalink
fix: incorrect status codes on the subscription page (#1463)
Browse files Browse the repository at this point in the history
* fix: incorrect status codes on the subscription page

* removed unnecessary information about exceptions
  • Loading branch information
Immortalety authored Nov 30, 2024
1 parent 2905ae1 commit deb5802
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ def get_validated_sub(
) -> UserResponse:
sub = get_subscription_payload(token)
if not sub:
raise HTTPException(status_code=204, detail="Invalid subscription token")
raise HTTPException(status_code=404, detail="Not Found")

dbuser = crud.get_user(db, sub['username'])
if not dbuser or dbuser.created_at > sub['created_at']:
raise HTTPException(status_code=204, detail="User not found or invalid creation date")
raise HTTPException(status_code=404, detail="Not Found")

if dbuser.sub_revoked_at and dbuser.sub_revoked_at > sub['created_at']:
raise HTTPException(status_code=204, detail="Subscription has been revoked")
raise HTTPException(status_code=404, detail="Not Found")

return dbuser

Expand Down

0 comments on commit deb5802

Please sign in to comment.