aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScorpil <scorpilmail@gmail.com>2012-07-20 00:49:08 +0300
committerScorpil <scorpilmail@gmail.com>2012-07-20 00:49:08 +0300
commitead018f7744f0d1f43e9b72cd678aa63309323f6 (patch)
tree00fba99d41b0e7f04d1126ea0b91539db5e61205
parent773ba63ab957a698e6e7fd2a6c80c9901a281d63 (diff)
downloadmarkdown-ead018f7744f0d1f43e9b72cd678aa63309323f6.tar.gz
markdown-ead018f7744f0d1f43e9b72cd678aa63309323f6.tar.bz2
markdown-ead018f7744f0d1f43e9b72cd678aa63309323f6.zip
Added more expressive description of an error.
-rw-r--r--markdown/odict.py6
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. """