From af521083469c082e86a18da91cd26e67d215f7c1 Mon Sep 17 00:00:00 2001 From: William Kray Date: Mon, 21 Apr 2025 08:26:07 -0700 Subject: [PATCH] add better handling around get_space_roomlist --- community/bot.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/community/bot.py b/community/bot.py index ebfad09..60f50d8 100644 --- a/community/bot.py +++ b/community/bot.py @@ -183,20 +183,24 @@ class CommunityBot(Plugin): results["dropped"].append(user) except Exception as e: - self.log.exception(e) + self.log.error(f"Error syncing space members: {e}") return results async def get_space_roomlist(self) -> None: space = self.config["parent_room"] rooms = [] - state = await self.client.get_state(space) - for evt in state: - if evt.type == EventType.SPACE_CHILD: + try: + self.log.debug(f"DEBUG getting roomlist from {space} space") + state = await self.client.get_state(space) + for evt in state: + if evt.type == EventType.SPACE_CHILD: # only look for rooms that include a via path, otherwise they # are not really in the space! - if evt.content and evt.content.via: - rooms.append(evt.state_key) + if evt.content and evt.content.via: + rooms.append(evt.state_key) + except Exception as e: + self.log.error(f"Error getting space roomlist: {e}") return rooms async def generate_report(self) -> None: