Prevent catching exception if exception handling was not enabled (or disabled by test test app).
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Thu, 01 Mar 2018 10:28:17 +0100
changeset 1960 372ec456664c
parent 1959 ce1bfd04b3f6
child 1961 b4a1ba9dbaf3
Prevent catching exception if exception handling was not enabled (or disabled by test test app).
Beremiz.py
--- a/Beremiz.py	Thu Mar 01 09:41:12 2018 +0100
+++ b/Beremiz.py	Thu Mar 01 10:28:17 2018 +0100
@@ -48,6 +48,7 @@
         self.splashPath = self.Bpath("images", "splash.png")
         self.modules = ["BeremizIDE"]
         self.debug = os.path.exists("BEREMIZ_DEBUG")
+        self.handle_exception = None
 
     def Bpath(self, *args):
         return os.path.join(self.app_dir, *args)
@@ -198,10 +199,13 @@
             self.CreateUI()
             self.CloseSplash()
             self.ShowUI()
-        # except (KeyboardInterrupt, SystemExit):
-        #     raise
+        except (KeyboardInterrupt, SystemExit):
+            raise
         except Exception:
-            self.handle_exception(*sys.exc_info(), exit=True)
+            if self.handle_exception is not None:
+                self.handle_exception(*sys.exc_info(), exit=True)
+            else:
+                raise
 
     def MainLoop(self):
         self.app.MainLoop()