From 8993affdc06be35b3680501ecd14a8d23901e497 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Wed, 19 Nov 2014 17:14:14 +0000 Subject: [PATCH] SYN-153: Raise 404 if room alias is not found --- synapse/handlers/directory.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py index 98ac0684fc..ed9b0f8551 100644 --- a/synapse/handlers/directory.py +++ b/synapse/handlers/directory.py @@ -122,10 +122,14 @@ class DirectoryHandler(BaseHandler): room_alias ) - defer.returnValue({ - "room_id": result.room_id, - "servers": result.servers, - }) + if result is not None: + defer.returnValue({ + "room_id": result.room_id, + "servers": result.servers, + }) + else: + raise SynapseError(404, "Room alias \"%s\" not found", room_alias) + @defer.inlineCallbacks def send_room_alias_update_event(self, user_id, room_id):