From bf97fd67b406e09549fbee15866b451933b57087 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 2 May 2019 21:55:54 -0600 Subject: [PATCH] Handle cases of no default server --- src/i18n/strings/en_EN.json | 1 + src/vector/index.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index faf3f39273..e84d87ac0d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1,6 +1,7 @@ { "Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.", "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.", + "Invalid configuration: no default server specified": "Invalid configuration: no default server specified", "Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s", "Unknown device": "Unknown device", "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s", diff --git a/src/vector/index.js b/src/vector/index.js index ed22d37b38..9c5eb061ac 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -452,8 +452,6 @@ async function verifyServerConfig() { // TODO: TravisR - Handle query string arguments for hs_url and is_url // We probably don't want to handle them unless the user is logged out though? - // TODO: TravisR - Handle case of no options specified whatsoever - const config = SdkConfig.get(); let wkConfig = config['default_server_config']; // overwritten later under some conditions const serverName = config['default_server_name']; @@ -467,6 +465,9 @@ async function verifyServerConfig() { "or default_hs_url.", )); } + if (incompatibleOptions.length < 1) { + throw newTranslatableError(_td("Invalid configuration: no default server specified.")); + } if (hsUrl) { console.log("Config uses a default_hs_url - constructing a default_server_config using this information");