[Pkg-privacy-commits] [tails-installer] 28/34: Make exception handling more robust in TailsInstallerThread.
anonym
anonym-tails-guest at moszumanska.debian.org
Mon Jan 22 14:05:33 UTC 2018
This is an automated email from the git hooks/post-receive script.
anonym-tails-guest pushed a commit to branch tails/master
in repository tails-installer.
commit ec31abbfb19306299925ebf0e49e9cdd0427b97e
Author: intrigeri <intrigeri at boum.org>
Date: Sat Jan 20 18:35:49 2018 +0000
Make exception handling more robust in TailsInstallerThread.
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.
---
tails_installer/gui.py | 10 +++++++---
1 file 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)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git
More information about the Pkg-privacy-commits
mailing list