From d9b7118f458004c2ac587de7a4d25110a1567edd Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 20 Dec 2019 09:30:57 -0400 Subject: [PATCH] load_past_events: raise instead of logging errors --- TODO.md | 1 - src/backend/matrix_client.py | 9 +++++---- src/gui/Pages/Chat/Timeline/EventList.qml | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/TODO.md b/TODO.md index 9b16cfdd..e8478ae7 100644 --- a/TODO.md +++ b/TODO.md @@ -48,7 +48,6 @@ ## Issues -- load_past raise - invisible uploaded mxc images? - first undecryptable message - Join button 502 diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index 77d106a7..4cde9f49 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -558,9 +558,7 @@ class MatrixClient(nio.AsyncClient): ) if isinstance(response, nio.RoomMessagesError): - log.error("Loading past messages for room %s failed: %s", - room_id, response) - return True + raise MatrixError.from_nio(response) self.loaded_once_rooms.add(room_id) more_to_load = True @@ -607,7 +605,10 @@ class MatrixClient(nio.AsyncClient): more = True while self.skipped_events[room_id] and not events and more: - more = await self.load_past_events(room_id) + try: + more = await self.load_past_events(room_id) + except MatrixError: + break async def new_direct_chat(self, invite: str, encrypt: bool = False) -> str: diff --git a/src/gui/Pages/Chat/Timeline/EventList.qml b/src/gui/Pages/Chat/Timeline/EventList.qml index 08c1e31e..8c21270a 100644 --- a/src/gui/Pages/Chat/Timeline/EventList.qml +++ b/src/gui/Pages/Chat/Timeline/EventList.qml @@ -133,7 +133,9 @@ Rectangle { chat.loadingMessages = true py.callClientCoro( - chat.userId, "load_past_events", [chat.roomId], + chat.userId, + "load_past_events", + [chat.roomId], moreToLoad => { try { eventList.canLoad = moreToLoad