about summary refs log tree commit diff
path: root/LibMatrix/Services/HomeserverProviderService.cs
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-01-29 10:14:42 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2024-01-29 10:14:42 +0100
commitb7dbc011e0eee55c011623d2747e517436d04106 (patch)
tree62e3283095ee3c19618fb8bd738e254222f4c805 /LibMatrix/Services/HomeserverProviderService.cs
parentMessageBuilder extensions (diff)
downloadLibMatrix-b7dbc011e0eee55c011623d2747e517436d04106.tar.xz
Get full state event
Diffstat (limited to 'LibMatrix/Services/HomeserverProviderService.cs')
-rw-r--r--LibMatrix/Services/HomeserverProviderService.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/LibMatrix/Services/HomeserverProviderService.cs b/LibMatrix/Services/HomeserverProviderService.cs
index 4cf74d1..5ac47f1 100644
--- a/LibMatrix/Services/HomeserverProviderService.cs
+++ b/LibMatrix/Services/HomeserverProviderService.cs
@@ -38,11 +38,20 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger
             logger.LogInformation("Homeserver {homeserver} proxied via {proxy}...", homeserver, proxy);
         logger.LogInformation("{homeserver}: {clientVersions}", homeserver, clientVersions.ToJson());
 
+        ServerVersionResponse serverVersion;
+        try {
+            serverVersion = serverVersion = await (rhs.FederationClient?.GetServerVersionAsync() ?? Task.FromResult<ServerVersionResponse?>(null)!);
+        }
+        catch (Exception e) {
+            logger.LogError(e, "Failed to get server version for {homeserver}", homeserver);
+            sem.Release();
+            throw;
+        }
+        
         try {
             if (clientVersions.UnstableFeatures.TryGetValue("gay.rory.mxapiextensions.v0", out bool a) && a)
                 hs = await AuthenticatedHomeserverGeneric.Create<AuthenticatedHomeserverMxApiExtended>(homeserver, accessToken, proxy);
             else {
-                var serverVersion = await (rhs.FederationClient?.GetServerVersionAsync() ?? Task.FromResult<ServerVersionResponse?>(null));
                 if (serverVersion is { Server.Name: "Synapse" })
                     hs = await AuthenticatedHomeserverGeneric.Create<AuthenticatedHomeserverSynapse>(homeserver, accessToken, proxy);
                 else