diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-11-01 23:28:07 +0100 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-11-01 23:47:25 +0100 |
commit | 0fca30bbdac79d8d33e152e7e7116c5ffa1356ca (patch) | |
tree | bfcd33f2bd68f220ffad956b07d37002dc06de9f /swiftstory/SwiftStory.py | |
parent | d66b6d0115e620f8c12629a5822cf31d3e976a20 (diff) |
Add WrongAction exception and use it instaed of returning error
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory/SwiftStory.py')
-rw-r--r-- | swiftstory/SwiftStory.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/swiftstory/SwiftStory.py b/swiftstory/SwiftStory.py index f9799ef..b81b0c3 100644 --- a/swiftstory/SwiftStory.py +++ b/swiftstory/SwiftStory.py @@ -8,6 +8,7 @@ import logging import websockets import swiftstory.GameManager +from swiftstory.exception import WrongAction from swiftstory.Client import Client from swiftstory.Status import error @@ -62,6 +63,8 @@ def message_received_handler(client, message): return opcodes_map[json_msg["op"]]() except (KeyError, TypeError): return error('invalid command') + except WrongAction as e: + return error(str(e)) async def connection_handler(websocket, path): |