Remove usages of EtebaseValidationError.
This commit is contained in:
parent
37f5a4509f
commit
cf7690a60f
@ -298,7 +298,7 @@ def signup_save(data: SignupIn, request: Request) -> User:
|
|||||||
except django_exceptions.ValidationError as e:
|
except django_exceptions.ValidationError as e:
|
||||||
transform_validation_error("user", e)
|
transform_validation_error("user", e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise EtebaseValidationError("generic", str(e))
|
raise HttpError("generic", str(e))
|
||||||
|
|
||||||
if hasattr(instance, "userinfo"):
|
if hasattr(instance, "userinfo"):
|
||||||
raise HttpError("user_exists", "User already exists", status_code=status.HTTP_409_CONFLICT)
|
raise HttpError("user_exists", "User already exists", status_code=status.HTTP_409_CONFLICT)
|
||||||
|
@ -3,9 +3,10 @@ import typing as t
|
|||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
from fastapi import status
|
from fastapi import status
|
||||||
|
|
||||||
from django_etebase.exceptions import EtebaseValidationError
|
|
||||||
from django_etebase.models import Stoken
|
from django_etebase.models import Stoken
|
||||||
|
|
||||||
|
from .exceptions import HttpError
|
||||||
|
|
||||||
# TODO missing stoken_annotation type
|
# TODO missing stoken_annotation type
|
||||||
StokenAnnotation = t.Any
|
StokenAnnotation = t.Any
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ def get_stoken_obj(stoken: t.Optional[str]) -> t.Optional[Stoken]:
|
|||||||
try:
|
try:
|
||||||
return Stoken.objects.get(uid=stoken)
|
return Stoken.objects.get(uid=stoken)
|
||||||
except Stoken.DoesNotExist:
|
except Stoken.DoesNotExist:
|
||||||
raise EtebaseValidationError("bad_stoken", "Invalid stoken.", status_code=status.HTTP_400_BAD_REQUEST)
|
raise HttpError("bad_stoken", "Invalid stoken.", status_code=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user