summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-07-07 11:41:07 +0100
committerErik Johnston <erik@matrix.org>2016-07-07 11:41:07 +0100
commitc98e1479bd39a64add0456299644e96480151625 (patch)
tree918a2fb4b68c620dfea507f1ee1715150350c6ac /synapse/storage/events.py
parentAdd rest servlet. Fix SQL. (diff)
downloadsynapse-c98e1479bd39a64add0456299644e96480151625.tar.xz
Return 400 rather than 500
Diffstat (limited to '')
-rw-r--r--synapse/storage/events.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 23ebd5d4c5..c2136f3fd1 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -23,6 +23,7 @@ from synapse.util.async import ObservableDeferred
 from synapse.util.logcontext import preserve_fn, PreserveLoggingContext
 from synapse.util.logutils import log_function
 from synapse.api.constants import EventTypes
+from synapse.api.errors import SynapseError
 
 from canonicaljson import encode_canonical_json
 from collections import deque, namedtuple
@@ -1324,7 +1325,9 @@ class EventsStore(SQLBaseStore):
         max_depth = max(row[0] for row in rows)
 
         if max_depth <= topological_ordering:
-            raise Exception("topological_ordering is greater than forward extremeties")
+            raise SynapseError(
+                400, "topological_ordering is greater than forward extremeties"
+            )
 
         txn.execute(
             "SELECT event_id, state_key FROM events"