better handle bad block names

This commit is contained in:
David Vierra 2010-09-19 13:43:40 -10:00
parent 3993f041ea
commit 69c29a08a8

19
mce.py
View File

@ -122,15 +122,22 @@ class mce(object):
else:
break;
if blockType is None:
print "Ambiguous block specifier. Matches: ", matches;
raise ValueError
else:
blockType = int(keyword);
try:
blockType = int(keyword);
except ValueError:
blockType = None;
if blockType is None:
print "Ambiguous block specifier: ", keyword
if len(matches):
print "Matches: ", matches;
else:
print "No blocks matched."
raise ValueError
return blockType
def _debug(self, command):