From 2b3d4a378353e52c3038e3c74f26ab8366b8b10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20M=C3=BCllegger?= Date: Fri, 21 Nov 2014 08:32:53 +0100 Subject: [PATCH] Checking for a more specific exception when user might have passed in a list without specifying many=True. --- rest_framework/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 2c14f000d..1a06308e7 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -163,7 +163,7 @@ class BaseSerializer(Field): if self.instance is not None and not getattr(self, '_errors', None): try: self._data = self.to_representation(self.instance) - except Exception as exc: + except AttributeError as exc: if isinstance(self.instance, (list, tuple, QuerySet)): msg = ( 'The reason for this exception might be that you '