Commit e6b06c34 by Evan Heidtmann

Add explanation for this exception mutation

parent bdb73d55
...@@ -74,6 +74,9 @@ def get_attribute(instance, attrs): ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment