From 42a72ce5c7bda317a2fcf2218704540f89544c6f Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 2 Sep 2020 12:50:47 +0300 Subject: [PATCH] Serializers user signup: correctly handle EtebaseValidationErrors. Don't coerce them to strings --- django_etebase/serializers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django_etebase/serializers.py b/django_etebase/serializers.py index 036da1e..babf7d0 100644 --- a/django_etebase/serializers.py +++ b/django_etebase/serializers.py @@ -450,6 +450,8 @@ class AuthenticationSignupSerializer(BetterErrorsMixin, serializers.Serializer): # Create the user and save the casing the user chose as the first name try: instance = create_user(**user_data, password=None, first_name=user_data['username'], view=view) + except EtebaseValidationError as e: + raise e except Exception as e: raise EtebaseValidationError('generic', str(e))