Skip to content

Commit

Permalink
Catch exceptions in load_game_bug() chat parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
gbtami committed Dec 30, 2024
1 parent 7a5e261 commit 7f3e4e8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions server/bug/utils_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,21 @@ async def load_game_bug(app_state: PychessGlobalAppState, game_id):
if doc.get("c") is not None:
chat = doc.get("c")
for key in chat:
idx = int(key.replace("m", ""))
game.steps[idx]["chat"] = []
for c in chat[key]:
game.steps[idx]["chat"].append(
{"message": c["m"], "username": c["u"], "time": c["t"]}
try:
idx = int(key.replace("m", ""))
game.steps[idx]["chat"] = []
for c in chat[key]:
game.steps[idx]["chat"].append(
{"message": c["m"], "username": c["u"], "time": c["t"]}
)
except Exception:
log.exception(
"ERROR: Exception in load_game() chat parsing %s %s %s",
game_id,
variant,
doc.get("c"),
)
break

app_state.games[game_id] = game
if game.status > STARTED:
Expand Down

0 comments on commit 7f3e4e8

Please sign in to comment.