aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_workspace.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-10-15 19:19:03 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commit0e4ac01dfd41a15eeb67de08ca788e82d3736a6f (patch)
treea76e93c28d64feec685bd19da10f26b8b802a719 /slack/slack_workspace.py
parent8065cf011b897de72330913c13aa11a7b3666368 (diff)
downloadwee-slack-0e4ac01dfd41a15eeb67de08ca788e82d3736a6f.tar.gz
Handle when some items are missing from the response
Diffstat (limited to 'slack/slack_workspace.py')
-rw-r--r--slack/slack_workspace.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py
index 0fab5b2..8c0f9a6 100644
--- a/slack/slack_workspace.py
+++ b/slack/slack_workspace.py
@@ -85,7 +85,10 @@ class SlackItem(
) -> SlackItemClass:
if items_info_task:
items_info = await items_info_task
- return self._create_item_from_info(items_info[item_id])
+ item = items_info.get(item_id)
+ if item is None:
+ raise SlackError(self.workspace, "item_not_found")
+ return self._create_item_from_info(item)
else:
return await self._item_class.create(self.workspace, item_id)