fix: surface all calendar sync failures, not just Google
CalDAV and Home Assistant sync failures were previously only logged
server-side, leaving clients unable to distinguish an empty calendar
from a broken sync. Unify error reporting across CalDAV, Home
Assistant, and Google into a single errors list on GET
/api/caldav/events, shaped as {source, name, message}. Messages are
fixed generic strings, never raw exception text, to avoid leaking
URLs or credential fragments. get_ha_events and get_google_events now
return (events, errors) tuples so per-calendar failures propagate to
the caller in addition to account-level failures. Frontend toast now
picks its label from err.source instead of assuming Google/err.email.
This commit is contained in:
@@ -377,8 +377,10 @@ async function fetchAndRender(force = false, silent = false) {
|
||||
const resp = await api.get(`/caldav/events?start=${fetchStart.toISOString()}&end=${fetchEnd.toISOString()}`);
|
||||
const events = resp.events || resp;
|
||||
if (resp.errors && resp.errors.length) {
|
||||
const sourceLabels = { caldav: 'CalDAV', homeassistant: 'Home Assistant', google: 'Google' };
|
||||
for (const err of resp.errors) {
|
||||
showToast(`Google (${err.email}): Token abgelaufen – bitte Konto trennen und neu verbinden`, true);
|
||||
const label = sourceLabels[err.source] || err.source || 'Kalender';
|
||||
showToast(`${label} (${err.name}): ${err.message}`, true);
|
||||
}
|
||||
}
|
||||
eventCache.start = fetchStart;
|
||||
|
||||
Reference in New Issue
Block a user