🥅 catch errors when searching for calendars

This commit is contained in:
Marc Koch 2025-08-19 15:30:07 +02:00
parent 2aed79e796
commit 13dc40302c
Signed by: marc
GPG Key ID: 12406554CFB028B9
1 changed files with 12 additions and 7 deletions

View File

@ -262,13 +262,18 @@ def clear(target_calendars: list, is_test: bool=False) -> dict:
# Get events from calendar
print(f"--- Clearing cancelled bookings and overlaps in calendar: {calendar.id}")
horizon = tcal_by_name[calendar.id].auto_clear_overlap_horizon_days
events_fetched = calendar.search(
start=datetime.now(),
end=date.today() + timedelta(days=horizon),
event=True,
expand=True,
split_expanded=True,
)
try:
events_fetched = calendar.search(
start=datetime.now(),
end=date.today() + timedelta(days=horizon),
event=True,
expand=True,
split_expanded=True,
)
except Exception as e:
print(f"--- Failed to fetch events for calendar: {calendar.id}: {e}")
continue
# Create DavEvent objects from fetched events
events = []