summary refs log tree commit diff
path: root/synapse/storage/databases/main/state.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-01-04 16:10:05 +0000
committerGitHub <noreply@github.com>2022-01-04 16:10:05 +0000
commitbd9821f7f17916deec9266483e26b69cd5ce2b3b (patch)
tree795949ca470eac01d78945b9b8b17cc0462f4870 /synapse/storage/databases/main/state.py
parentInclude the topic event in the prejoin state, per MSC3173. (#11666) (diff)
downloadsynapse-bd9821f7f17916deec9266483e26b69cd5ce2b3b.tar.xz
Better error messages from `get_create_event_for_room` (#11638)
"Unknown room" can mean a multitude of things here. To help with debugging, add
some more words to the exception text.
Diffstat (limited to 'synapse/storage/databases/main/state.py')
-rw-r--r--synapse/storage/databases/main/state.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/storage/databases/main/state.py b/synapse/storage/databases/main/state.py
index 7e5a6aae18..2fb3e65192 100644
--- a/synapse/storage/databases/main/state.py
+++ b/synapse/storage/databases/main/state.py
@@ -177,11 +177,15 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
             NotFoundError if the room is unknown
         """
         state_ids = await self.get_current_state_ids(room_id)
+
+        if not state_ids:
+            raise NotFoundError(f"Current state for room {room_id} is empty")
+
         create_id = state_ids.get((EventTypes.Create, ""))
 
         # If we can't find the create event, assume we've hit a dead end
         if not create_id:
-            raise NotFoundError("Unknown room %s" % (room_id,))
+            raise NotFoundError(f"No create event in current state for room {room_id}")
 
         # Retrieve the room's create event and return
         create_event = await self.get_event(create_id)