From 5c7760e2c068c2feb17fb218624237c36f64bb5e Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Sun, 29 Sep 2019 17:30:57 +0100 Subject: [PATCH] Check for errors during sync --- main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.py b/main.py index 8ff3cf8..c4aef8b 100644 --- a/main.py +++ b/main.py @@ -7,6 +7,7 @@ from nio import ( AsyncClientConfig, RoomMessageText, InviteEvent, + SyncError, ) from callbacks import Callbacks from config import Config @@ -52,6 +53,11 @@ async def main(): # Sync with the server sync_response = await client.sync(timeout=30000, full_state=True, since=token) + # Check if the sync had an error + if type(sync_response) == SyncError: + logger.warning("Error in client sync: %s", sync_response.message) + continue + # Save the latest sync token token = sync_response.next_batch if token: