mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Add explanation for this exception mutation
This commit is contained in:
parent
bdb73d5588
commit
e6b06c34c1
|
@ -74,6 +74,9 @@ def get_attribute(instance, attrs):
|
||||||
try:
|
try:
|
||||||
instance = instance()
|
instance = instance()
|
||||||
except (AttributeError, KeyError) as exc:
|
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))
|
raise ValueError('Exception raised in callable attribute "{0}"; original exception was: {1}'.format(attr, exc))
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
Loading…
Reference in New Issue
Block a user