General cleanup - Exception messages and improved logging.
Stars HHC, HHC itself and Hand. Should not get the first 100 characters of an failing hand in the log, which contains the handid for later reference. Played around with the number of characters a while ago - 100 chars is about the sweet spot.
This commit is contained in:
parent
12ad272f91
commit
0c3cdb12f8
|
@ -274,15 +274,16 @@ If a player has None chips he won't be added."""
|
|||
self.streets.update(match.groupdict())
|
||||
log.debug("markStreets:\n"+ str(self.streets))
|
||||
else:
|
||||
tmp = self.handText[0:100]
|
||||
log.error("markstreets didn't match")
|
||||
log.error(" - Assuming hand cancelled")
|
||||
self.cancelled = True
|
||||
raise FpdbParseError
|
||||
raise FpdbParseError("FpdbParseError: markStreets appeared to fail: First 100 chars: '%s'" % tmp)
|
||||
|
||||
def checkPlayerExists(self,player):
|
||||
if player not in [p[1] for p in self.players]:
|
||||
print "checkPlayerExists", player, "fail"
|
||||
raise FpdbParseError
|
||||
print "DEBUG: checkPlayerExists %s fail" % player
|
||||
raise FpdbParseError("checkPlayerExists: '%s' failed." % player)
|
||||
|
||||
|
||||
|
||||
|
@ -1487,9 +1488,9 @@ class Pot(object):
|
|||
if self.sym is None:
|
||||
self.sym = "C"
|
||||
if self.total is None:
|
||||
print "call Pot.end() before printing pot total"
|
||||
print "DEBUG: call Pot.end() before printing pot total"
|
||||
# NB if I'm sure end() is idempotent, call it here.
|
||||
raise FpdbParseError
|
||||
raise FpdbParseError("FpdbError in printing Hand object")
|
||||
|
||||
ret = "Total pot %s%.2f" % (self.sym, self.total)
|
||||
if len(self.pots) < 2:
|
||||
|
|
|
@ -137,8 +137,7 @@ Otherwise, finish at EOF.
|
|||
self.numHands += 1
|
||||
except FpdbParseError, e:
|
||||
self.numErrors += 1
|
||||
log.warning("Failed to convert hand %s" % e.hid)
|
||||
log.warning("Exception msg: '%s'" % str(e))
|
||||
log.warning("HHC.start(follow): processHand failed: Exception msg: '%s'" % e)
|
||||
log.debug(handText)
|
||||
else:
|
||||
handsList = self.allHandsAsList()
|
||||
|
@ -152,8 +151,7 @@ Otherwise, finish at EOF.
|
|||
self.processedHands.append(self.processHand(handText))
|
||||
except FpdbParseError, e:
|
||||
self.numErrors += 1
|
||||
log.warning("Failed to convert hand %s" % e.hid)
|
||||
log.warning("Exception msg: '%s'" % str(e))
|
||||
log.warning("HHC.start(): processHand failed: Exception msg: '%s'" % e)
|
||||
log.debug(handText)
|
||||
self.numHands = len(handsList)
|
||||
endtime = time.time()
|
||||
|
|
|
@ -140,7 +140,7 @@ class PokerStars(HandHistoryConverter):
|
|||
tmp = handText[0:100]
|
||||
log.error("determineGameType: Unable to recognise gametype from: '%s'" % tmp)
|
||||
log.error("determineGameType: Raising FpdbParseError")
|
||||
raise FpdbParseError
|
||||
raise FpdbParseError("Unable to recognise gametype from: '%s'" % tmp)
|
||||
|
||||
mg = m.groupdict()
|
||||
# translations from captured groups to fpdb info strings
|
||||
|
@ -194,7 +194,7 @@ class PokerStars(HandHistoryConverter):
|
|||
except KeyError:
|
||||
log.error("determineGameType: Lim_Blinds has no lookup for '%s'" % mg['BB'])
|
||||
log.error("determineGameType: Raising FpdbParseError")
|
||||
raise FpdbParseError
|
||||
raise FpdbParseError("Lim_Blinds has no lookup for '%s'" % mg['BB'])
|
||||
|
||||
# NB: SB, BB must be interpreted as blinds or bets depending on limit type.
|
||||
return info
|
||||
|
|
Loading…
Reference in New Issue
Block a user