diff options
| -rw-r--r-- | rest_framework/fields.py | 6 | 
1 files changed, 5 insertions, 1 deletions
| diff --git a/rest_framework/fields.py b/rest_framework/fields.py index a5348922..01e7c78c 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -71,7 +71,11 @@ def get_attribute(instance, attrs):          except ObjectDoesNotExist:              return None          if is_simple_callable(instance): -            instance = instance() +            try: +                instance = instance() +            except (AttributeError, KeyError) as exc: +                raise ValueError('Exception raised in callable attribute "{0}"; original exception was: {1}'.format(attr, exc)) +      return instance | 
