waiting dialog: handle exceptions
authorThomasV <thomasv@gitorious>
Mon, 16 Jun 2014 16:06:39 +0000 (18:06 +0200)
committerThomasV <thomasv@gitorious>
Mon, 16 Jun 2014 16:06:39 +0000 (18:06 +0200)
gui/qt/util.py

index e6c13a8..9139136 100644 (file)
@@ -21,11 +21,19 @@ class WaitingDialog(QThread):
         self.d.show()
 
     def run(self):
-        self.result = self.run_task()
+        self.error = None
+        try:
+            self.result = self.run_task()
+        except Exception as e:
+            self.error = str(e)
         self.d.emit(SIGNAL('done'))
 
     def close(self):
         self.d.accept()
+        if self.error:
+            QMessageBox.warning(self.parent, _('Error'), self.error, _('OK'))
+            return
+
         if self.on_complete:
             self.on_complete(*self.result)