[neon/forks/ubuntu-release-upgrader/Neon/unstable_jammy] DistUpgrade: fix exception handler

Harald Sitter null at kde.org
Tue Apr 26 19:20:53 BST 2022


Git commit 7ea2d6fd9ce5983f25fe14ee479c2a739c8b9a8c by Harald Sitter.
Committed on 26/04/2022 at 18:15.
Pushed by sitter into branch 'Neon/unstable_jammy'.

fix exception handler

- when apport didn't actually do anything always show the custom dialog
- additionally when apport isn't run always show the custom dialog
- fix the dialog code to actually not use non-existant variables & ui members
- set the actual description as seen in the gtk+ ui
- set an actual icon (use fromTheme because qt4 compat actually should go away)

M  +8    -4    DistUpgrade/DistUpgradeViewKDE.py

https://invent.kde.org/neon/forks/ubuntu-release-upgrader/commit/7ea2d6fd9ce5983f25fe14ee479c2a739c8b9a8c

diff --git a/DistUpgrade/DistUpgradeViewKDE.py b/DistUpgrade/DistUpgradeViewKDE.py
index a22427e1..aa913a5b 100644
--- a/DistUpgrade/DistUpgradeViewKDE.py
+++ b/DistUpgrade/DistUpgradeViewKDE.py
@@ -702,13 +702,17 @@ class DistUpgradeViewKDE(DistUpgradeView):
         logging.error("not handled exception in KDE frontend:\n%s" % "\n".join(lines))
         # we can't be sure that apport will run in the middle of a upgrade
         # so we still show a error message here
-        apport_crash(exctype, excvalue, exctb)
-        if not run_apport():
+        apport_ran = apport_crash(exctype, excvalue, exctb)
+        logging.debug("run apport? %s; ran apport? %s",
+                      str(run_apport()), str(ran_apport))
+        if not run_apport() or not apport_ran:
             tbtext = ''.join(traceback.format_exception(exctype, excvalue, exctb))
             dialog = QDialog(self.window_main)
             loadUi("dialog_error.ui", dialog)
-            self.translate_widget_children(self.dialog)
-            dialog.crash_detail.setText(tbtext)
+            self.translate_widget_children(dialog)
+            dialog.label_error.setText(_('A fatal error occurred'))
+            dialog.image.setPixmap(QIcon.fromTheme('dialog-error').pixmap(48, 48))
+            dialog.textview_error.setText(tbtext)
             # Make sure we have a suitable size depending on whether or not the view is shown
             dialog.adjustSize()
             dialog.exec_()



More information about the Neon-commits mailing list