about summary refs log tree commit diff
path: root/LibMatrix/Services
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix/Services')
-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