aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorEvan Heidtmann2015-02-26 09:20:17 -0800
committerEvan Heidtmann2015-02-26 09:20:17 -0800
commite6b06c34c1ee526b65c92b9071c47be2ddc668c4 (patch)
tree82723f44818ed86f0e1e9210d82ac46dbf735d8d /rest_framework/fields.py
parentbdb73d558891192c96368d5ca2266327302dba54 (diff)
downloaddjango-rest-framework-e6b06c34c1ee526b65c92b9071c47be2ddc668c4.tar.bz2
Add explanation for this exception mutation
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index 01e7c78c..f2791a13 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -74,6 +74,9 @@ def get_attribute(instance, attrs):
try:
instance = instance()
except (AttributeError, KeyError) as exc:
+ # If we raised an Attribute or KeyError here it'd get treated
+ # as an omitted field in `Field.get_attribute()`. Instead we
+ # raise a ValueError to ensure the exception is not masked.
raise ValueError('Exception raised in callable attribute "{0}"; original exception was: {1}'.format(attr, exc))
return instance