1
0
mirror of https://github.com/etesync/server synced 2024-11-25 18:28:46 +00:00

Remove usages of EtebaseValidationError.

This commit is contained in:
Tom Hacohen 2020-12-28 10:45:34 +02:00
parent 37f5a4509f
commit cf7690a60f
2 changed files with 4 additions and 3 deletions

View File

@ -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)

View File

@ -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