add handler on user not found exception

This commit is contained in:
Timur
2025-03-01 23:24:48 +03:00
parent 3a33f0dfc9
commit 7e4012bf09
+4 -1
View File
@@ -19,7 +19,10 @@ class BearerAuth(HttpBearer):
except Exception:
raise AuthenticationError
user = User.objects.get(id=data["id"])
try:
user = User.objects.get(id=data["id"])
except User.DoesNotExist:
raise AuthenticationError
return user
@staticmethod