Skip to content

Commit c21e7ce

Browse files
committed
More logging
1 parent ee7d336 commit c21e7ce

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

modules/models/slack_models/shared_models.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,15 @@ def __init__(self, team_info: SlackTeamInfo) -> None:
283283
def find_channel_by_name(self, channel_name: str) -> SlackConversationInfo:
284284
logger.debug(f"Finding channel by name: {channel_name}")
285285
logger.debug(f"Full channel list: {[conversation_info.name for conversation_info in self.full_conversation_list]}")
286-
return [
287-
conversation
288-
for conversation in self.full_conversation_list
289-
if conversation.name == channel_name
290-
][0]
291-
286+
try:
287+
return [
288+
conversation
289+
for conversation in self.full_conversation_list
290+
if conversation.name == channel_name
291+
][0]
292+
except IndexError:
293+
logger.exception(f"Could not find channel by name: {channel_name}")
294+
raise Exception(f"Could not find channel by name: {channel_name}")
292295
@property
293296
def slack_id(self) -> str:
294297
return self._team_info.id

0 commit comments

Comments
 (0)