diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-01-14 21:48:12 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | a703cb532e9ed7ac404f48fa292903f392484805 (patch) | |
tree | b06e53f0dc74212227f302b9d060fd710fb99b15 | |
parent | f790f652d3428404f789822a9bd510ff866d1640 (diff) | |
download | wee-slack-a703cb532e9ed7ac404f48fa292903f392484805.tar.gz |
Raise exceptions on errors
-rw-r--r-- | slack/slack_conversation.py | 4 | ||||
-rw-r--r-- | slack/slack_user.py | 2 | ||||
-rw-r--r-- | slack/slack_workspace.py | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py index 49b7a2a..ebfc859 100644 --- a/slack/slack_conversation.py +++ b/slack/slack_conversation.py @@ -61,7 +61,7 @@ class SlackConversation: info = await self.api.fetch_conversations_info(self) if info["ok"] is False: # TODO: Handle error - return + raise Exception("Failed fetching conversation info") info_channel = info["channel"] if info_channel["is_im"] is True: @@ -86,7 +86,7 @@ class SlackConversation: history = await self.api.fetch_conversations_history(self) if history["ok"] is False: # TODO: Handle error - return + raise Exception("Failed fetching conversation history") start = time.time() messages = [SlackMessage(self, message) for message in history["messages"]] diff --git a/slack/slack_user.py b/slack/slack_user.py index 6cb3897..4386657 100644 --- a/slack/slack_user.py +++ b/slack/slack_user.py @@ -20,5 +20,5 @@ class SlackUser: info = await self.api.fetch_users_info(self) if info["ok"] is False: # TODO: Handle error - return + raise Exception("Failed fetching user info") self.name = info["user"]["name"] diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py index e659eba..c5296c0 100644 --- a/slack/slack_workspace.py +++ b/slack/slack_workspace.py @@ -44,7 +44,7 @@ class SlackWorkspace: ) if user_channels_response["ok"] is False: # TODO: Handle error - return + raise Exception("Failed fetching conversations") user_channels = user_channels_response["channels"] |