add better handling around get_space_roomlist

This commit is contained in:
William Kray
2025-04-21 08:26:07 -07:00
parent 9cd95ca1c8
commit af52108346
+5 -1
View File
@@ -183,13 +183,15 @@ class CommunityBot(Plugin):
results["dropped"].append(user) results["dropped"].append(user)
except Exception as e: except Exception as e:
self.log.exception(e) self.log.error(f"Error syncing space members: {e}")
return results return results
async def get_space_roomlist(self) -> None: async def get_space_roomlist(self) -> None:
space = self.config["parent_room"] space = self.config["parent_room"]
rooms = [] rooms = []
try:
self.log.debug(f"DEBUG getting roomlist from {space} space")
state = await self.client.get_state(space) state = await self.client.get_state(space)
for evt in state: for evt in state:
if evt.type == EventType.SPACE_CHILD: if evt.type == EventType.SPACE_CHILD:
@@ -197,6 +199,8 @@ class CommunityBot(Plugin):
# are not really in the space! # are not really in the space!
if evt.content and evt.content.via: if evt.content and evt.content.via:
rooms.append(evt.state_key) rooms.append(evt.state_key)
except Exception as e:
self.log.error(f"Error getting space roomlist: {e}")
return rooms return rooms
async def generate_report(self) -> None: async def generate_report(self) -> None: