summary refs log tree commit diff
path: root/synapse/events/builder.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-05-21 13:47:25 +0100
committerGitHub <noreply@github.com>2019-05-21 13:47:25 +0100
commit04d53794d6848cca2567d67f494ba8405d0bf1cf (patch)
tree87512338fea4a3a1ba714060a472da88e169d4e4 /synapse/events/builder.py
parentRevert "expose SlavedProfileStore to ClientReaderSlavedStore (#5200)" (diff)
downloadsynapse-04d53794d6848cca2567d67f494ba8405d0bf1cf.tar.xz
Fix error handling for rooms whose versions are unknown. (#5219)
If we remove support for a particular room version, we should behave more
gracefully. This should make client requests fail with a 400 rather than a 500,
and will ignore individiual PDUs in a federation transaction, rather than the
whole transaction.
Diffstat (limited to 'synapse/events/builder.py')
-rw-r--r--synapse/events/builder.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/events/builder.py b/synapse/events/builder.py
index fba27177c7..1fe995f212 100644
--- a/synapse/events/builder.py
+++ b/synapse/events/builder.py
@@ -18,6 +18,7 @@ import attr
 from twisted.internet import defer
 
 from synapse.api.constants import MAX_DEPTH
+from synapse.api.errors import UnsupportedRoomVersionError
 from synapse.api.room_versions import (
     KNOWN_EVENT_FORMAT_VERSIONS,
     KNOWN_ROOM_VERSIONS,
@@ -178,9 +179,8 @@ class EventBuilderFactory(object):
         """
         v = KNOWN_ROOM_VERSIONS.get(room_version)
         if not v:
-            raise Exception(
-                "No event format defined for version %r" % (room_version,)
-            )
+            # this can happen if support is withdrawn for a room version
+            raise UnsupportedRoomVersionError()
         return self.for_room_version(v, key_values)
 
     def for_room_version(self, room_version, key_values):