summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--synapse/handlers/room.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index b33fe09f77..ed780bb41f 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -909,7 +909,12 @@ class RoomCreationHandler(BaseHandler):
             )
             return last_stream_id
 
-        config = self._presets_dict[preset_config]
+        try:
+            config = self._presets_dict[preset_config]
+        except KeyError:
+            raise SynapseError(
+                400, f"'{preset_config}' is not a valid preset", errcode=Codes.BAD_JSON
+            )
 
         creation_content.update({"creator": creator_id})
         await send(etype=EventTypes.Create, content=creation_content)