Raise an exception when a card cannot be found
This commit is contained in:
parent
fa5cf52120
commit
f3d400d2dd
1 changed files with 4 additions and 1 deletions
|
@ -16,7 +16,10 @@ class TextDB(Database):
|
|||
def __init__(self, filename):
|
||||
self.filename = filename
|
||||
def getCard(self, name):
|
||||
return self.findCard(name).next()
|
||||
try:
|
||||
return self.findCard(name).next()
|
||||
except:
|
||||
raise Exception('Invalid card: {0}'.format(name))
|
||||
def findCard(self, name=None):
|
||||
card = None
|
||||
with open(self.filename, 'r') as f:
|
||||
|
|
Loading…
Reference in a new issue