From 349d467d9bae3e8d2cfd121ab63ad437a8e934bd Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Tue, 23 Jun 2015 15:18:38 +0100 Subject: handle the case when no cards are collected Signed-off-by: Olivier Gayot --- server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server.py') diff --git a/server.py b/server.py index 5d117e9..162cd5d 100755 --- a/server.py +++ b/server.py @@ -39,11 +39,12 @@ def message_received_handler(client, server, message): elif op == 'pick_black_card': res = client['cao_client'].pick_black_card() elif op == 'designate_card': + card_id = None try: card_id = int(json_msg['card_id']) - except KeyError: - res = cao_error('field `card_id\' is required') - else: + except (KeyError, TypeError): + pass + finally: res = client['cao_client'].designate_card(card_id) elif op == 'play_white_card': try: -- cgit v1.2.3