More async/await. Improve error display

This commit is contained in:
James Lyne 2021-05-18 18:27:44 +01:00
parent 2f8c4a9ab3
commit 87024079cc

View File

@ -51,15 +51,17 @@ export default defineComponent({
updateTimeout = ref(0), updateTimeout = ref(0),
configAttempts = ref(0), configAttempts = ref(0),
loadConfiguration = () => { loadConfiguration = async () => {
return store.dispatch(ActionTypes.LOAD_CONFIGURATION, undefined).then(() => { try {
await store.dispatch(ActionTypes.LOAD_CONFIGURATION, undefined);
startUpdates(); startUpdates();
requestAnimationFrame(() => window.hideSplash()); requestAnimationFrame(() => window.hideSplash());
}).catch(e => { } catch(e) {
console.error('Failed to load server configuration: ', e); const error = `Failed to load server configuration for '${store.state.currentServer}'`;
window.showSplashError('Failed to load server configuration\n' + e, false, ++configAttempts.value); console.error(`${error}:`, e);
window.showSplashError(`${error}\n${e}`, false, ++configAttempts.value);
setTimeout(() => loadConfiguration(), 1000); setTimeout(() => loadConfiguration(), 1000);
}); }
}, },
startUpdates = () => { startUpdates = () => {