summaryrefslogtreecommitdiff
path: root/swiftstory/Client.py
diff options
context:
space:
mode:
Diffstat (limited to 'swiftstory/Client.py')
-rw-r--r--swiftstory/Client.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/swiftstory/Client.py b/swiftstory/Client.py
index 93aa900..b1a6ae7 100644
--- a/swiftstory/Client.py
+++ b/swiftstory/Client.py
@@ -1,6 +1,7 @@
import asyncio
import logging
+from swiftstory.exception import WrongAction
from swiftstory.Status import error
@@ -14,7 +15,7 @@ class Client:
def join_game(self, game_name, lang):
if self.game is not None:
- return error('You are already in a game')
+ raise WrongAction('You are already in a game')
if lang is None:
lang = 'en'
@@ -29,37 +30,37 @@ class Client:
def play_white_card(self, card_id):
if self.game is None:
- return error('You have to join a game first')
+ raise WrongAction('You have to join a game first')
return self.game.try_play_card(self.player, card_id)
def pick_black_card(self):
if self.game is None:
- return error('You have to join a game first')
+ raise WrongAction('You have to join a game first')
return self.game.try_become_judge(self.player)
def collect_cards(self):
if self.game is None:
- return error('You have to join a game first')
+ raise WrongAction('You have to join a game first')
return self.game.try_collect_cards(self.player)
def designate_card(self, card_id):
if self.game is None:
- return error('You have to join a game first')
+ raise WrongAction('You have to join a game first')
return self.game.try_designate_card(self.player, card_id)
def view_player_cards(self):
if self.game is None:
- return error('You have to join a game first')
+ raise WrongAction('You have to join a game first')
return self.game.try_view_player_cards(self.player)
def view_played_cards(self):
if self.game is None:
- return error('You have to join a game first')
+ raise WrongAction('You have to join a game first')
return self.game.try_view_played_cards(self.player)
def view_black_card(self):
if self.game is None:
- return error('You have to join a game first')
+ raise WrongAction('You have to join a game first')
return self.game.try_view_black_card(self.player)
def register_notification(self, message):