From 5396fd765dc8030a0c02fab325092dfd84eb25e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 1 Apr 2016 14:11:30 +0200 Subject: [PATCH] Better reporting when the user is not logged in. --- blender_cloud/gui.py | 10 +++++++++- blender_cloud/pillar.py | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/blender_cloud/gui.py b/blender_cloud/gui.py index b6f2ee6..509f0da 100644 --- a/blender_cloud/gui.py +++ b/blender_cloud/gui.py @@ -566,7 +566,15 @@ class BlenderCloudBrowser(bpy.types.Operator): bgl.glRectf(0, 0, content_width, content_height) font_id = 0 - text = "An error occurred:\n%s" % self.async_task.exception() + ex = self.async_task.exception() + if isinstance(ex, pillar.UserNotLoggedInError): + ex_msg = 'You are not logged in on Blender ID. Please log in at User Preferences, ' \ + 'System, Blender ID.' + else: + ex_msg = str(ex) + if not ex_msg: + ex_msg = str(type(ex)) + text = "An error occurred:\n%s" % ex_msg lines = textwrap.wrap(text) bgl.glColor4f(1.0, 1.0, 1.0, 1.0) diff --git a/blender_cloud/pillar.py b/blender_cloud/pillar.py index c8ef537..611a967 100644 --- a/blender_cloud/pillar.py +++ b/blender_cloud/pillar.py @@ -27,6 +27,9 @@ class UserNotLoggedInError(RuntimeError): This is basically for every interaction with Pillar. """ + def __str__(self): + return 'UserNotLoggedInError' + class PillarError(RuntimeError): """Raised when there is some issue with the communication with Pillar.