improve error text when room is too large

This commit is contained in:
Amber H. Brown 2019-07-01 23:13:21 +10:00
parent e001115221
commit 0993b05ca5

View File

@ -38,6 +38,11 @@ from ._base import BaseHandler
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
id_server_scheme = "https://" id_server_scheme = "https://"
ROOM_COMPLEXITY_TOO_GREAT = (
"Your homeserver is unable to join rooms this large or complex. "
"Please speak to your server administrator, or upgrade your instance "
"to join this room."
)
class RoomMemberHandler(object): class RoomMemberHandler(object):
@ -1087,9 +1092,8 @@ class RoomMemberMasterHandler(RoomMemberHandler):
room_id, remote_room_hosts room_id, remote_room_hosts
) )
if too_complex is True: if too_complex is True:
msg = "Room too large (preflight)"
raise SynapseError( raise SynapseError(
code=400, msg=msg, code=400, msg=ROOM_COMPLEXITY_TOO_GREAT,
errcode=Codes.RESOURCE_LIMIT_EXCEEDED errcode=Codes.RESOURCE_LIMIT_EXCEEDED
) )
@ -1129,9 +1133,8 @@ class RoomMemberMasterHandler(RoomMemberHandler):
room_id=room_id, room_id=room_id,
action="leave" action="leave"
) )
msg = "Room too large (postflight)"
raise SynapseError( raise SynapseError(
code=400, msg=msg, code=400, msg=ROOM_COMPLEXITY_TOO_GREAT,
errcode=Codes.RESOURCE_LIMIT_EXCEEDED errcode=Codes.RESOURCE_LIMIT_EXCEEDED
) )