fix: Error Handling in Backend und Frontend verbessern (Phase 5, Schritt 31)

- Backend: JSON-Parse-Error + Payload-Too-Large Middleware in index.js
- Backend: Dashboard äußerer try/catch für db.get()-Fehler
- Backend: contacts/meta Route mit try/catch
- Frontend: try/catch + Toast-Fallback in loadMonth (budget), loadRange (calendar),
  loadWeek (meals), loadLists/switchList (shopping), initiales Laden (notes)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ulsklyc
2026-03-26 00:35:16 +01:00
parent e068a14819
commit 2e3e67baeb
8 changed files with 75 additions and 19 deletions
+11 -3
View File
@@ -351,8 +351,14 @@ function updateListCounter(listId, totalDelta, checkedDelta) {
// --------------------------------------------------------
async function loadLists() {
const data = await api.get('/shopping');
state.lists = data.data ?? [];
try {
const data = await api.get('/shopping');
state.lists = data.data ?? [];
} catch (err) {
console.error('[Shopping] loadLists Fehler:', err);
state.lists = [];
window.oikos?.showToast('Listen konnten nicht geladen werden.', 'danger');
}
}
async function loadItems(listId) {
@@ -366,9 +372,11 @@ async function switchList(listId, container) {
renderTabs(container);
try {
await loadItems(listId);
} catch {
} catch (err) {
console.error('[Shopping] loadItems Fehler:', err);
state.items = [];
state.activeList = state.lists.find((l) => l.id === listId) ?? null;
window.oikos?.showToast('Artikel konnten nicht geladen werden.', 'danger');
}
renderListContent(container);
wireListContentEvents(container);