diff --git a/django/template/base.py b/django/template/base.py
index b96e446..809ac06 100644
a
|
b
|
class Variable(object):
|
682 | 682 | except (TypeError, AttributeError, KeyError): |
683 | 683 | try: # attribute lookup |
684 | 684 | current = getattr(current, bit) |
685 | | except (TypeError, AttributeError): |
| 685 | except (TypeError, AttributeError), error: |
| 686 | if hasattr(current, "__class__"): # method/property has code errors within |
| 687 | if hasattr(current.__class__, bit): |
| 688 | raise VariableDoesNotExist("Failed lookup for key [%s] in %r \n %s", (bit, current, error)) |
686 | 689 | try: # list-index lookup |
687 | 690 | current = current[int(bit)] |
688 | 691 | except (IndexError, # list index out of range |