Sync: gracefully handle credential sync errors

This commit is contained in:
Sybren A. Stüvel 2016-06-24 14:46:27 +02:00
parent 4d2314e08f
commit 645529bf35

View File

@ -355,6 +355,8 @@ class PILLAR_OT_sync(pillar.PillarOperatorMixin,
try: try:
self.user_id = await self.check_credentials(context) self.user_id = await self.check_credentials(context)
log.debug('Found user ID: %s', self.user_id)
try: try:
self.home_project_id = await get_home_project_id() self.home_project_id = await get_home_project_id()
except sdk_exceptions.ForbiddenAccess: except sdk_exceptions.ForbiddenAccess:
@ -388,6 +390,9 @@ class PILLAR_OT_sync(pillar.PillarOperatorMixin,
'REFRESH': self.action_refresh, 'REFRESH': self.action_refresh,
}[action] }[action]
await action_method(context) await action_method(context)
except pillar.CredentialsNotSyncedError:
self.log.exception('Error checking/refreshing credentials.')
self.bss_report({'ERROR'}, 'Please log in on Blender ID first.')
except Exception as ex: except Exception as ex:
self.log.exception('Unexpected exception caught.') self.log.exception('Unexpected exception caught.')
self.bss_report({'ERROR'}, 'Unexpected error: %s' % ex) self.bss_report({'ERROR'}, 'Unexpected error: %s' % ex)