diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-06-23 15:18:38 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-06-23 15:18:38 +0100 |
commit | 349d467d9bae3e8d2cfd121ab63ad437a8e934bd (patch) | |
tree | 969a40b648c9a0b674ab5c608af9147252799762 /server.py | |
parent | f706345678fb53464b4aaa821fb21b9b48894150 (diff) |
handle the case when no cards are collected
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'server.py')
-rwxr-xr-x | server.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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: |