Trap problems using the Todoist API

master
Andrew Williams 2015-12-12 13:54:42 +00:00
parent 2564f972d8
commit 97bd4f7fb4
1 changed files with 37 additions and 33 deletions

View File

@ -84,7 +84,11 @@ def main():
# Main loop # Main loop
while True: while True:
try:
api.sync(resource_types=['projects', 'labels', 'items']) api.sync(resource_types=['projects', 'labels', 'items'])
except Exception as e:
logging.exception('Error trying to sync with Todoist API: %s' % str(e))
else:
for project in api.projects.all(): for project in api.projects.all():
project_type = get_project_type(project) project_type = get_project_type(project)
if project_type: if project_type: