# HG changeset patch # User Edouard Tisserant # Date 1648534786 -7200 # Node ID 91b2c014494e3901225f1b4ec6bc5b9f7ad38df2 # Parent a47d9debb0d969087a07e04f1e217b319eafef98 IDE: in case of unhandled exception, write bug report to given log file, so that test report can have it. diff -r a47d9debb0d9 -r 91b2c014494e Beremiz.py --- a/Beremiz.py Tue Mar 22 14:51:30 2022 +0100 +++ b/Beremiz.py Tue Mar 29 08:19:46 2022 +0200 @@ -186,7 +186,7 @@ def InstallExceptionHandler(self): import version import util.ExceptionHandler - self.handle_exception = util.ExceptionHandler.AddExceptHook(version.app_version) + self.handle_exception = util.ExceptionHandler.AddExceptHook(version.app_version, logf=self.logf) def CreateUI(self): self.frame = self.BeremizIDE.Beremiz(None, self.projectOpen, self.buildpath, logf=self.logf) diff -r a47d9debb0d9 -r 91b2c014494e util/ExceptionHandler.py --- a/util/ExceptionHandler.py Tue Mar 22 14:51:30 2022 +0100 +++ b/util/ExceptionHandler.py Tue Mar 29 08:19:46 2022 +0200 @@ -93,7 +93,7 @@ ignored_exceptions = [] # a problem with a line in a module is only reported once per session -def AddExceptHook(app_version='[No version]'): +def AddExceptHook(app_version='[No version]', logf = None): def save_bug_report(e_type, e_value, e_traceback, bug_report_path, date): info = { @@ -125,7 +125,10 @@ lst = info.keys() lst.sort() for a in lst: - output.write(a + ":\n" + str(info[a]) + "\n\n") + line = a + ":\n" + str(info[a]) + "\n\n" + output.write(line) + if logf is not None: + logf.write(line) output.close() def handle_exception(e_type, e_value, e_traceback, exit=False):