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):
|
def __init__(self, filename):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
def getCard(self, name):
|
def getCard(self, name):
|
||||||
|
try:
|
||||||
return self.findCard(name).next()
|
return self.findCard(name).next()
|
||||||
|
except:
|
||||||
|
raise Exception('Invalid card: {0}'.format(name))
|
||||||
def findCard(self, name=None):
|
def findCard(self, name=None):
|
||||||
card = None
|
card = None
|
||||||
with open(self.filename, 'r') as f:
|
with open(self.filename, 'r') as f:
|
||||||
|
|
Loading…
Reference in a new issue