check_game: handle error if game is not in DB
This commit is contained in:
parent
fb713fcf9e
commit
217d5b4a82
1 changed files with 4 additions and 1 deletions
|
@ -22,7 +22,10 @@ def check_game(game_id: int) -> Tuple[int, GameState]:
|
||||||
"WHERE games.id = (%s)",
|
"WHERE games.id = (%s)",
|
||||||
(game_id,)
|
(game_id,)
|
||||||
)
|
)
|
||||||
(num_players, compressed_deck, compressed_actions, score, variant_id) = cur.fetchone()
|
res = cur.fetchone()
|
||||||
|
if res is None:
|
||||||
|
raise ValueError("No game associated with id {} in database.".format(game_id))
|
||||||
|
(num_players, compressed_deck, compressed_actions, score, variant_id) = res
|
||||||
deck = decompress_deck(compressed_deck)
|
deck = decompress_deck(compressed_deck)
|
||||||
actions = decompress_actions(compressed_actions)
|
actions = decompress_actions(compressed_actions)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue