Handle cases of no default server

This commit is contained in:
Travis Ralston 2019-05-02 21:55:54 -06:00
parent 45caa8baab
commit bf97fd67b4
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,7 @@
{ {
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.", "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: 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", "Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
"Unknown device": "Unknown device", "Unknown device": "Unknown device",
"%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s", "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s",

View File

@ -452,8 +452,6 @@ async function verifyServerConfig() {
// TODO: TravisR - Handle query string arguments for hs_url and is_url // 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? // 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(); const config = SdkConfig.get();
let wkConfig = config['default_server_config']; // overwritten later under some conditions let wkConfig = config['default_server_config']; // overwritten later under some conditions
const serverName = config['default_server_name']; const serverName = config['default_server_name'];
@ -467,6 +465,9 @@ async function verifyServerConfig() {
"or default_hs_url.", "or default_hs_url.",
)); ));
} }
if (incompatibleOptions.length < 1) {
throw newTranslatableError(_td("Invalid configuration: no default server specified."));
}
if (hsUrl) { if (hsUrl) {
console.log("Config uses a default_hs_url - constructing a default_server_config using this information"); console.log("Config uses a default_hs_url - constructing a default_server_config using this information");