Attract project refresh: Show report when credential checking fails

This commit is contained in:
Sybren A. Stüvel 2016-10-04 16:42:13 +02:00
parent 6b5faa423e
commit 534a5a6ac4

View File

@ -378,12 +378,21 @@ class PILLAR_OT_projects(async_loop.AsyncModalOperatorMixin,
bl_label = 'Fetch available projects' bl_label = 'Fetch available projects'
stop_upon_exception = True stop_upon_exception = True
_log = logging.getLogger('bpy.ops.%s' % bl_idname)
async def async_execute(self, context): async def async_execute(self, context):
import pillarsdk import pillarsdk
from .pillar import pillar_call from .pillar import pillar_call
self._log.info('Checking credentials')
try:
db_user = await self.check_credentials(context, ()) db_user = await self.check_credentials(context, ())
except pillar.UserNotLoggedInError as ex:
self._log.info('Not logged in error raised: %s', ex)
self.report({'ERROR'}, 'Please log in on Blender ID first.')
self.quit()
return
user_id = db_user['_id'] user_id = db_user['_id']
self.log.info('Going to fetch projects for user %s', user_id) self.log.info('Going to fetch projects for user %s', user_id)