diff options
-rw-r--r-- | markdown/odict.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/markdown/odict.py b/markdown/odict.py index d545a46..4de4424 100644 --- a/markdown/odict.py +++ b/markdown/odict.py @@ -117,7 +117,11 @@ class OrderedDict(dict): def index(self, key): """ Return the index of a given key. """ - return self.keyOrder.index(key) + try: + return self.keyOrder.index(key) + except ValueError, e: + raise KeyError("Element '%s' was not found in OrderedDict" % key) + def index_for_location(self, location): """ Return index or None for a given location. """ |