Hand: Wrap Pot.end() section in exception handler

If Hand.end() fails in that section, then something is seriously wrong with either action parsing or stack parsing.

Throw a parse error in the hopes we can continue on.
This commit is contained in:
Worros 2010-09-02 14:02:19 +08:00
parent 376894bba3
commit 304c9e71a2

View File

@ -1514,11 +1514,15 @@ class Pot(object):
commitsall = sorted([(v,k) for (k,v) in self.committed.items() if v >0])
self.pots = []
try:
while len(commitsall) > 0:
commitslive = [(v,k) for (v,k) in commitsall if k in self.contenders]
v1 = commitslive[0][0]
self.pots += [sum([min(v,v1) for (v,k) in commitsall])]
commitsall = [((v-v1),k) for (v,k) in commitsall if v-v1 >0]
except IndexError, e:
log.error(_("Pot.end(): Major failure while calculating pot: '%s'" % e))
raise FpdbParseError(_("Pot.end(): Major failure while calculating pot: '%s'" % e))
# TODO: I think rake gets taken out of the pots.
# so it goes: