From 1f18b5053c44d418e3059a789cb9bdf40f3f9b10 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Mon, 2 Nov 2020 00:03:20 +0100 Subject: also add the JoinError exception type Signed-off-by: Olivier Gayot --- swiftstory/Game.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'swiftstory/Game.py') diff --git a/swiftstory/Game.py b/swiftstory/Game.py index 0df2e16..0057bc7 100644 --- a/swiftstory/Game.py +++ b/swiftstory/Game.py @@ -1,6 +1,6 @@ import random -from swiftstory.exception import WrongAction +from swiftstory.exception import WrongAction, JoinError from swiftstory.Player import Player from swiftstory.Board import Board from swiftstory.Status import error, success @@ -30,7 +30,7 @@ class Game: def try_join(self, client): if len(self.players) >= 10: - return error('too many players in this game') + raise JoinError('too many players in this game') cards = [] @@ -38,7 +38,7 @@ class Game: for _ in range(10): cards.append(self.board.pick_white_card()) except IndexError: - return error('no enough white cards for player') + raise JoinError('not enough white cards for player') player = Player(client) -- cgit v1.2.3