Merge pull request 'fix: guard db_game against NameError when db_post fails in complete_game (#27)' (#86) from ai/paper-dynasty-discord27 into main
Some checks are pending
Build Docker Image / build (push) Waiting to run

This commit is contained in:
Claude 2026-03-23 03:58:31 +00:00
commit 376e0b8a31

View File

@ -4295,12 +4295,14 @@ async def complete_game(
else this_game.away_team
)
db_game = None
try:
db_game = await db_post("games", payload=game_data)
db_ready_plays = get_db_ready_plays(session, this_game, db_game["id"])
db_ready_decisions = get_db_ready_decisions(session, this_game, db_game["id"])
except Exception as e:
await roll_back(db_game["id"])
if db_game is not None:
await roll_back(db_game["id"])
log_exception(e, msg="Unable to post game to API, rolling back")
# Post game stats to API