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

@ -224,14 +224,15 @@ 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:
info.update(m.groupdict())
m = self.re_HandInfo.search(hand.handText,re.DOTALL)
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: