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/Client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'swiftstory/Client.py') diff --git a/swiftstory/Client.py b/swiftstory/Client.py index 93ea232..a84783d 100644 --- a/swiftstory/Client.py +++ b/swiftstory/Client.py @@ -1,7 +1,7 @@ import asyncio import logging -from swiftstory.exception import WrongAction +from swiftstory.exception import WrongAction, UnsupportedLanguage, JoinError class Client: @@ -19,7 +19,10 @@ class Client: if lang is None: lang = 'en' - game = self.game_manager.join_game(game_name, lang) + try: + game = self.game_manager.join_game(game_name, lang) + except UnsupportedLanguage as e: + raise JoinError(f"unsupported language: {str(e)}") from e # XXX self.game will be assigned by game.try_join() return game.try_join(self) -- cgit v1.2.3