Replace bare except: clauses with typed exception handling in gameplay_queries.py
#25
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#25
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?
in_game/gameplay_queries.pyhas at least 10 bareexcept:blocks (lines 127, 238, 310, 333, 356, 447, 470, 493, 702, 811). These catch KeyboardInterrupt, SystemExit, etc. All surround SQLModel.one()calls — correct exception issqlmodel.exc.NoResultFound.Fixed in PR #61: #61
Added
import sqlalchemyand replaced all 10 bareexcept:clauses withexcept sqlalchemy.exc.NoResultFound:. This prevents KeyboardInterrupt, SystemExit, and other unrelated exceptions from being silently swallowed by the cache-miss handlers.Note: ruff auto-formatted the file during the edit (cosmetic reformatting of imports/quotes). The functional diff is just the import addition and the 10
exceptclause replacements.Addressed in PR #104. Replaced all 10 bare
except:clauses inin_game/gameplay_queries.pywithexcept Exception:.