about summary refs log tree commit diff
path: root/LibMatrix/Helpers/SyncHelper.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-03-31 09:30:02 +0200
committerRory& <root@rory.gay>2025-03-31 09:30:22 +0200
commitfee33ee3ff27c3c89ff8a27701242b62334f8e58 (patch)
tree0b63d1beea6f7102e830487f937cdc376d305dfc /LibMatrix/Helpers/SyncHelper.cs
parentSplit out invite context, add empty filter constants (diff)
downloadLibMatrix-fee33ee3ff27c3c89ff8a27701242b62334f8e58.tar.xz
Propagate more HTTP errors, sync error handling callback
Diffstat (limited to 'LibMatrix/Helpers/SyncHelper.cs')
-rw-r--r--LibMatrix/Helpers/SyncHelper.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/LibMatrix/Helpers/SyncHelper.cs b/LibMatrix/Helpers/SyncHelper.cs

index babdd6f..9b1b921 100644 --- a/LibMatrix/Helpers/SyncHelper.cs +++ b/LibMatrix/Helpers/SyncHelper.cs
@@ -149,6 +149,7 @@ public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, ILogger? logg catch (Exception e) { Console.WriteLine(e); logger?.LogError(e, "Failed to sync!\n{}", e.ToString()); + await Task.WhenAll(ExceptionHandlers.Select(x => x.Invoke(e)).ToList()); } return null; @@ -257,8 +258,13 @@ public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, ILogger? logg /// </summary> public List<Func<StateEventResponse, Task>> AccountDataReceivedHandlers { get; } = new(); + /// <summary> + /// Event fired when an exception is thrown + /// </summary> + public List<Func<Exception, Task>> ExceptionHandlers { get; } = new(); + private void Log(string message) { if (logger is null) Console.WriteLine(message); else logger.LogInformation(message); } -} +} \ No newline at end of file