From c7f78bdaf5609dd2d4030b6b892748df6c098501 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Thu, 18 Feb 2021 13:01:13 +0100 Subject: [PATCH] fix: Dont catch sync errors --- lib/src/client.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 210ea5d1..9ce752f4 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -951,15 +951,19 @@ class Client extends MatrixApi { _retryDelay = Future.delayed(Duration(seconds: syncErrorTimeoutSec)); if (!isLogged() || _disposed || _aborted) return null; try { + var syncError; final syncRequest = sync( filter: syncFilters, since: prevBatch, timeout: prevBatch != null ? 30000 : null, setPresence: syncPresence, - ); + ).catchError((e) => syncError = e); _currentSyncId = syncRequest.hashCode; final syncResp = await syncRequest; + if (syncError != null) throw syncError; if (_currentSyncId != syncRequest.hashCode) { + Logs() + .w('Current sync request ID has changed. Dropping this sync loop!'); return; } if (database != null) {