From a23f3d6143ca866bf990c71162e915c26b7c227e Mon Sep 17 00:00:00 2001 From: Scorpil Date: Fri, 20 Jul 2012 00:42:43 +0300 Subject: Added more expressive description of an error. --- markdown/odict.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/markdown/odict.py b/markdown/odict.py index d545a46..2beabaa 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") + def index_for_location(self, location): """ Return index or None for a given location. """ -- cgit v1.2.3