Use wider try-except block

The 'temp_key' table name in hud_dict can vanish between DB roundtrips.
Enclose all three lines within try-block.
This commit is contained in:
Mika Bostrom 2009-11-28 10:59:44 +02:00
parent 81e77ebfcf
commit 2f742e371b

View File

@ -215,10 +215,10 @@ class HUD_main(object):
# Update an existing HUD
if temp_key in self.hud_dict:
# get stats using hud's specific params and get cards
try:
self.db_connection.init_hud_stat_vars( self.hud_dict[temp_key].hud_params['hud_days']
, self.hud_dict[temp_key].hud_params['h_hud_days'])
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, type, self.hud_dict[temp_key].hud_params, self.hero_ids[site_id])
try:
self.hud_dict[temp_key].stat_dict = stat_dict
except KeyError: # HUD instance has been killed off, key is stale
sys.stderr.write('hud_dict[%s] was not found\n' % temp_key)