let settled accept multiple proms + i18n

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-04-08 20:12:05 +01:00
parent 2837c41ca4
commit f6ad5bf54c
2 changed files with 14 additions and 13 deletions

View File

@ -1,11 +1,12 @@
{
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
"Your Riot is misconfigured": "Your Riot is misconfigured",
"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.",
"Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.",
"The message from the parser is: %(message)s": "The message from the parser is: %(message)s",
"Invalid JSON": "Invalid JSON",
"Your Riot is misconfigured": "Your Riot is misconfigured",
"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.",
"Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.",
"Open user settings": "Open user settings",
"Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",

View File

@ -33,11 +33,13 @@ if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw.js');
}
async function settled(prom: Promise<any>) {
try {
await prom;
} catch (e) {
console.error(e);
async function settled(...promises: Array<Promise<any>>) {
for (const prom of promises) {
try {
await prom;
} catch (e) {
console.error(e);
}
}
}
@ -141,9 +143,7 @@ async function start() {
const loadSkinPromise = loadSkin();
// await things settling so that any errors we have to render have features like i18n running
await settled(loadSkinPromise);
await settled(loadThemePromise);
await settled(loadLanguagePromise);
await settled(loadSkinPromise, loadThemePromise, loadLanguagePromise);
// ##########################
// error handling begins here
@ -173,7 +173,7 @@ async function start() {
// await things starting successfully
// ##################################
await loadOlmPromise;
await settled(loadSkinPromise);
await loadSkinPromise;
await loadThemePromise;
await loadLanguagePromise;