Stars: Minor refactor to readHandInfo

Make the readHandInfo function throw an exception if either of the regexes used fails to match
This commit is contained in:
Worros 2010-08-27 14:44:19 +08:00
parent 6b978b8290
commit de9c0d9ba6

View File

@ -225,13 +225,14 @@ class PokerStars(HandHistoryConverter):
def readHandInfo(self, hand):
info = {}
m = self.re_HandInfo.search(hand.handText,re.DOTALL)
if m:
info.update(m.groupdict())
else:
pass # throw an exception here, eh?
m = self.re_GameInfo.search(hand.handText)
if m:
m2 = self.re_GameInfo.search(hand.handText)
if m is None or m2 is None:
logging.info("Didn't match re_HandInfo")
logging.info(hand.handText)
raise FpdbParseError("No match in readHandInfo.")
info.update(m.groupdict())
info.update(m2.groupdict())
log.debug("readHandInfo: %s" % info)
for key in info: