Fix potential NameError on db_game when db_post fails in complete_game
#27
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
ai-working
bug
enhancement
feature
in-queue
performance
security
tech-debt
todo
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#27
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
command_logic/logic_gameplay.py:4284-4290. Ifdb_game = await db_post("games", ...)raises, theexceptblock referencesdb_game["id"]for rollback — butdb_gamewas never assigned. Masks the original error and prevents rollback.PR #59 opens the fix: #59
Approach: Initialized
db_game = Nonebefore thetryblock, then guarded theroll_back(db_game["id"])call in theexceptwithif db_game is not None:. Ifdb_postraises beforedb_gameis ever assigned, the except clause now skips the rollback (there's nothing to roll back) and letslog_exceptionrecord the real error — noNameError, no masked exception.PR previously submitted included 15 modified files, likely catching other active work. PR has been closed without prejudice.
PR #86 opened: #86
Fix: added
db_game = Nonebefore the try block and guardedroll_back(db_game["id"])withif db_game is not None:— preventsNameErrorfrom masking the original exception whendb_post("games")raises before assignment.