summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2018-01-20 18:35:49 +0000
committerintrigeri <intrigeri@boum.org>2018-01-20 18:50:07 +0000
commitec31abbfb19306299925ebf0e49e9cdd0427b97e (patch)
tree38259e54f33ff33ae8dee062a20953209f3cadbf
parentc860c1d065e634c56b8bb05f1a66abe50120961e (diff)
Make exception handling more robust in TailsInstallerThread.bugfix/14622-installer-check-space-before-deleting
If what we're passed has no "args" attribute we raise an exception in the exception handler and fail to log anything useful. The status method is delegated to TailsInstallerWindow.status that already has some logic to do the right thing depending on what it receives, so let's not assume anything in TailsInstallerThread.status and forward what we get as-is. Then, in TailsInstallerWindow.status, also assume less about our argument, again to avoid failing in the exception handler.
-rwxr-xr-xtails_installer/gui.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tails_installer/gui.py b/tails_installer/gui.py
index 0224043..b5c6f3d 100755
--- a/tails_installer/gui.py
+++ b/tails_installer/gui.py
@@ -259,7 +259,7 @@ class TailsInstallerThread(threading.Thread):
self.installation_complete()
except Exception, e:
- self.status(e.args[0])
+ self.status(e)
self.status(_("Tails installation failed!"))
self.live.log.exception(unicode(e))
self.live.log.debug(traceback.format_exc())
@@ -637,9 +637,13 @@ class TailsInstallerWindow(Gtk.ApplicationWindow):
self.__progressbar.set_fraction(value)
def status(self, text):
- if isinstance(text, Exception):
+ self.live.log.debug("Argument is of type '%(type)s'"
+ % {'type': type(text).__name__})
+ if isinstance(text, Exception) \
+ and hasattr(text, 'args') \
+ and type(text.args).__name__ == 'list':
text = text.args[0]
- elif isinstance(text, int):
+ else:
text = str(text)
self.append_to_log(text)