summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Wagner <mitch.wagna@gmail.com>2018-06-14 14:08:40 +0200
committerMichael Wagner <mitch.wagna@gmail.com>2018-06-14 14:08:40 +0200
commit19cd3120ec59f6bce3d01a920fe462a914e1ae0e (patch)
tree8cc0aba8a6910f7775279fec7c8ebd1123bb72e4
parentMerge tag 'v0.31.1' (diff)
downloadsynapse-19cd3120ec59f6bce3d01a920fe462a914e1ae0e.tar.xz
Add error code to room creation error
This error code is mentioned in the documentation at https://matrix.org/docs/api/client-server/#!/Room32creation/createRoom
-rw-r--r--synapse/handlers/room.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 2abd63ad05..ab72963d87 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -23,7 +23,7 @@ from synapse.types import UserID, RoomAlias, RoomID, RoomStreamToken
 from synapse.api.constants import (
     EventTypes, JoinRules, RoomCreationPreset
 )
-from synapse.api.errors import AuthError, StoreError, SynapseError
+from synapse.api.errors import AuthError, Codes, StoreError, SynapseError
 from synapse.util import stringutils
 from synapse.visibility import filter_events_for_client
 
@@ -115,7 +115,11 @@ class RoomCreationHandler(BaseHandler):
             )
 
             if mapping:
-                raise SynapseError(400, "Room alias already taken")
+                raise SynapseError(
+                    400,
+                    "Room alias already taken",
+                    Codes.ROOM_IN_USE
+                )
         else:
             room_alias = None