summary refs log tree commit diff
path: root/synapse/storage/search.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-11-05 16:10:54 +0000
committerErik Johnston <erik@matrix.org>2015-11-05 16:10:54 +0000
commit3640ddfbf6641a79b486d3847ae739c974c62c7a (patch)
tree99a3de2e6428e7ae807bd3bdc26c5f60d02c630a /synapse/storage/search.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into erikj/search (diff)
downloadsynapse-3640ddfbf6641a79b486d3847ae739c974c62c7a.tar.xz
Error handling
Diffstat (limited to 'synapse/storage/search.py')
-rw-r--r--synapse/storage/search.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/storage/search.py b/synapse/storage/search.py
index 7342e7bae6..3cea2011fa 100644
--- a/synapse/storage/search.py
+++ b/synapse/storage/search.py
@@ -16,6 +16,7 @@
 from twisted.internet import defer
 
 from _base import SQLBaseStore
+from synapse.api.errors import SynapseError
 from synapse.storage.engines import PostgresEngine, Sqlite3Engine
 
 import logging
@@ -130,7 +131,13 @@ class SearchStore(SQLBaseStore):
         )
 
         if pagination_token:
-            topo, stream = pagination_token.split(",")
+            try:
+                topo, stream = pagination_token.split(",")
+                topo = int(topo)
+                stream = int(stream)
+            except:
+                raise SynapseError(400, "Invalid pagination token")
+
             clauses.append(
                 "(topological_ordering < ?"
                 " OR (topological_ordering = ? AND stream_ordering < ?))"