From ead018f7744f0d1f43e9b72cd678aa63309323f6 Mon Sep 17 00:00:00 2001 From: Scorpil Date: Fri, 20 Jul 2012 00:49:08 +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..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. """ -- cgit v1.2.3