Check for errors during sync
This commit is contained in:
parent
3df8d481c9
commit
5c7760e2c0
1 changed files with 6 additions and 0 deletions
6
main.py
6
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:
|
||||
|
|
Loading…
Reference in a new issue