Refactor error handling in various components to ignore modal display failures and improve code clarity
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 51s

This commit is contained in:
Torsten Schulz (local)
2025-12-20 10:19:29 +01:00
parent b20b89d333
commit 42b9a10437
9 changed files with 46 additions and 17 deletions

View File

@@ -615,13 +615,17 @@ const saveConfig = async () => {
})
successMessage.value = 'Konfiguration erfolgreich gespeichert!'
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Konfiguration erfolgreich gespeichert!') } catch (e) {}
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Konfiguration erfolgreich gespeichert!') } catch (_e) {
// Modal nicht verfügbar, ignorieren
}
setTimeout(() => {
successMessage.value = ''
}, 3000)
} catch (error) {
errorMessage.value = error.data?.message || 'Fehler beim Speichern der Konfiguration.'
try { window.showErrorModal && window.showErrorModal('Fehler', errorMessage.value) } catch (e) {}
try { window.showErrorModal && window.showErrorModal('Fehler', errorMessage.value) } catch (_e) {
// Modal nicht verfügbar, ignorieren
}
} finally {
isSaving.value = false
}

View File

@@ -168,9 +168,13 @@ async function save() {
const updated = { ...current, seiten: { ...(current.seiten || {}), geschichte: html } }
try {
await $fetch('/api/config', { method: 'PUT', body: updated })
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Inhalt erfolgreich gespeichert!') } catch (e) {}
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Inhalt erfolgreich gespeichert!') } catch (_e) {
// Modal nicht verfügbar, ignorieren
}
} catch (error) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (e) {}
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (_e) {
// Modal nicht verfügbar, ignorieren
}
}
}

View File

@@ -675,7 +675,8 @@ const loadExistingData = async () => {
}
}
}
} catch (error) {
} catch (_error) {
// Fehler beim Laden der Datei, ignorieren
}
}
</script>

View File

@@ -193,9 +193,13 @@ async function save() {
const updated = { ...current, seiten: { ...(current.seiten || {}), ttRegeln: html } }
try {
await $fetch('/api/config', { method: 'PUT', body: updated })
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Regeln erfolgreich gespeichert!') } catch (e) {}
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Regeln erfolgreich gespeichert!') } catch (_e) {
// Modal nicht verfügbar, ignorieren
}
} catch (error) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (e) {}
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (_e) {
// Modal nicht verfügbar, ignorieren
}
}
}

View File

@@ -120,9 +120,13 @@ async function save() {
const updated = { ...current, seiten: { ...(current.seiten || {}), ueberUns: html } }
try {
await $fetch('/api/config', { method: 'PUT', body: updated })
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Inhalt erfolgreich gespeichert!') } catch (e) {}
try { window.showSuccessModal && window.showSuccessModal('Erfolg', 'Inhalt erfolgreich gespeichert!') } catch (_e) {
// Modal nicht verfügbar, ignorieren
}
} catch (error) {
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (e) {}
try { window.showErrorModal && window.showErrorModal('Fehler', error?.data?.message || 'Speichern fehlgeschlagen') } catch (_e) {
// Modal nicht verfügbar, ignorieren
}
}
}