From 54456320266c72bb39cc4ee5acaf0e3b4c8c5418 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 15 Apr 2019 22:06:24 -0600 Subject: [PATCH] Use new js-sdk properties for getting discovery errors Requires https://github.com/matrix-org/matrix-js-sdk/pull/899 --- src/vector/index.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/vector/index.js b/src/vector/index.js index 1e8c4b6c7a..7ef5838d06 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -448,20 +448,6 @@ async function loadLanguage() { async function verifyServerConfig() { console.log("Verifying homeserver configuration"); - // Errors which can be returned by .well-known lookups. If autodiscovery fails for unexpected reasons, - // the last thing we want is "missing-translation|en:Your error here". The actual strings are also defined - // in the react-sdk, so we don't need them here. - const discoveryErrors = [ - "Invalid homeserver discovery response", - "Failed to get autodiscovery configuration from server", - "Invalid base_url for m.homeserver", - "Homeserver URL does not appear to be a valid Matrix homeserver", - "Invalid identity server discovery response", - "Invalid base_url for m.identity_server", - "Identity server URL does not appear to be a valid identity server", - "General failure", - ]; - const config = SdkConfig.get(); let wkConfig = config['default_server_config']; // overwritten later under some conditions const serverName = config['default_server_name']; @@ -512,7 +498,7 @@ async function verifyServerConfig() { const hsResult = result['m.homeserver']; if (hsResult.state !== AutoDiscovery.SUCCESS) { - if (discoveryErrors.indexOf(hsResult.error) !== -1) { + if (AutoDiscovery.ALL_ERRORS.indexOf(hsResult.error) !== -1) { throw newTranslatableError(hsResult.error); } throw newTranslatableError(_td("Unexpected error resolving homeserver configuration"));