mirror of
https://github.com/etesync/server
synced 2024-12-28 18:28:07 +00:00
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:
|
||||
transform_validation_error("user", e)
|
||||
except Exception as e:
|
||||
raise EtebaseValidationError("generic", str(e))
|
||||
raise HttpError("generic", str(e))
|
||||
|
||||
if hasattr(instance, "userinfo"):
|
||||
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 fastapi import status
|
||||
|
||||
from django_etebase.exceptions import EtebaseValidationError
|
||||
from django_etebase.models import Stoken
|
||||
|
||||
from .exceptions import HttpError
|
||||
|
||||
# TODO missing stoken_annotation type
|
||||
StokenAnnotation = t.Any
|
||||
|
||||
@ -15,7 +16,7 @@ def get_stoken_obj(stoken: t.Optional[str]) -> t.Optional[Stoken]:
|
||||
try:
|
||||
return Stoken.objects.get(uid=stoken)
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user