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),
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 = () => {