Hello, 

Since serializer.is_valid()  does not catch the Exceptions other than the 
validationError, how can i raise custom exceptions in validate method and 
then catch get them with serializer.errors

for example:

class Foo(serializers.Serializer):
    def validate(self, data):
        raise exceptions.AuthenticationFailed("message")

#### then I want to test it like this but serializer.is_valid() line always 
return error. 
serializer = Foo(some.data)
is_valid = serializer.is_valid()
expected_error = {['message.']}

self.assertFalse(is_valid)
self.assertEqual(serializer.errors, expected_error)



I also could not figure out how to handle it with custom exception handler 
can you help me about this. I also appreciate if you supply some examples 


-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to