comparison multimerge.py @ 68:42b6acc5988e

Add some error handling.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 Jul 2016 08:37:38 +0300
parents c582522d2dcc
children d5e3ca4b609d
comparison
equal deleted inserted replaced
67:c582522d2dcc 68:42b6acc5988e
483 ## Now, we fetch and collect events 483 ## Now, we fetch and collect events
484 gcm_debug(u"Fetching calendar events .. ") 484 gcm_debug(u"Fetching calendar events .. ")
485 src_events = [] 485 src_events = []
486 for calendar in src_calendars: 486 for calendar in src_calendars:
487 gcm_debug(u"- "+calendar["id"]) 487 gcm_debug(u"- "+calendar["id"])
488 result = service.events().list( 488 try:
489 timeZone="EEST", 489 result = service.events().list(
490 calendarId=calendar["id"], 490 timeZone="EEST",
491 singleEvents=True, 491 calendarId=calendar["id"],
492 showDeleted=False, 492 singleEvents=True,
493 # orderBy="startTime", 493 showDeleted=False,
494 ).execute() 494 # orderBy="startTime",
495 ).execute()
496 except Exception as e:
497 gcm_fatal(u"Failed to fetch calendar events for {0}:\n\n{1}\n\nERROR: {2}\n".format(calendar["id"], calendar, str(e)))
495 498
496 c_found = None 499 c_found = None
497 if "colorId" in calendar and calendar["colorId"] in colors["calendar"]: 500 if "colorId" in calendar and calendar["colorId"] in colors["calendar"]:
498 gcm_debug(u"Calendar color: {0}".format(colors["calendar"][calendar["colorId"]])) 501 gcm_debug(u"Calendar color: {0}".format(colors["calendar"][calendar["colorId"]]))
499 c_found = gcm_find_nearest_color(colors["event"], colors["calendar"][calendar["colorId"]], 100) 502 c_found = gcm_find_nearest_color(colors["event"], colors["calendar"][calendar["colorId"]], 100)