changeset 68:42b6acc5988e

Add some error handling.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 Jul 2016 08:37:38 +0300
parents c582522d2dcc
children 8ef792b573a9
files multimerge.py
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/multimerge.py	Tue Jul 12 01:01:10 2016 +0300
+++ b/multimerge.py	Tue Jul 12 08:37:38 2016 +0300
@@ -485,13 +485,16 @@
 src_events = []
 for calendar in src_calendars:
     gcm_debug(u"- "+calendar["id"])
-    result = service.events().list(
-        timeZone="EEST",
-        calendarId=calendar["id"],
-        singleEvents=True,
-        showDeleted=False,
-#        orderBy="startTime",
-        ).execute()
+    try:
+        result = service.events().list(
+            timeZone="EEST",
+            calendarId=calendar["id"],
+            singleEvents=True,
+            showDeleted=False,
+#            orderBy="startTime",
+            ).execute()
+    except Exception as e:
+        gcm_fatal(u"Failed to fetch calendar events for {0}:\n\n{1}\n\nERROR: {2}\n".format(calendar["id"], calendar, str(e)))
 
     c_found = None
     if "colorId" in calendar and calendar["colorId"] in colors["calendar"]: