mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-11-20 12:07:48 +00:00
add handler on user not found exception
This commit is contained in:
1 parent
3a33f0dfc9
commit
7e4012bf09
1 file changed
+4
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user