From b3962979301c3736f94481fa42c875f9a920eadc Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" Date: Wed, 24 Jul 2019 15:24:44 +0100 Subject: Give a proper error for invalid pagination tokens. Signed-off-by: Olivier Wilkinson (reivilibre) --- synapse/handlers/room_list.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py index e24f82f327..4774905c40 100644 --- a/synapse/handlers/room_list.py +++ b/synapse/handlers/room_list.py @@ -25,6 +25,7 @@ from twisted.internet import defer from synapse.api.constants import EventTypes, JoinRules from synapse.api.errors import Codes, HttpResponseException +from synapse.api.errors import SynapseError from synapse.types import ThirdPartyInstanceID from synapse.util.caches.descriptors import cachedInlineCallbacks from synapse.util.caches.response_cache import ResponseCache @@ -135,12 +136,12 @@ class RoomListHandler(BaseHandler): timing out. TODO """ pagination_token = None - if since_token and since_token != "END": # todo ought we support END and START? + if since_token and since_token != "END": if since_token[0] in ("+", "-"): forwards = since_token[0] == "+" pagination_token = since_token[1:] else: - raise SyntaxError("shrug ") # TODO + raise SynapseError(400, "Invalid since token.") else: forwards = True -- cgit 1.5.1