From 87024079cc6bdd72bfed3a10d37b3da435251782 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Tue, 18 May 2021 18:27:44 +0100 Subject: [PATCH] More async/await. Improve error display --- src/App.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3c020df..b28dc7d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -51,15 +51,17 @@ export default defineComponent({ updateTimeout = ref(0), configAttempts = ref(0), - loadConfiguration = () => { - return store.dispatch(ActionTypes.LOAD_CONFIGURATION, undefined).then(() => { + loadConfiguration = async () => { + try { + await store.dispatch(ActionTypes.LOAD_CONFIGURATION, undefined); startUpdates(); requestAnimationFrame(() => window.hideSplash()); - }).catch(e => { - console.error('Failed to load server configuration: ', e); - window.showSplashError('Failed to load server configuration\n' + e, false, ++configAttempts.value); + } catch(e) { + const error = `Failed to load server configuration for '${store.state.currentServer}'`; + console.error(`${error}:`, e); + window.showSplashError(`${error}\n${e}`, false, ++configAttempts.value); setTimeout(() => loadConfiguration(), 1000); - }); + } }, startUpdates = () => {