screen: exception info now includes a traceback

This commit is contained in:
alfrix 2023-09-12 12:28:33 -03:00
parent 79f4b45713
commit cfb38405c6

View File

@ -97,7 +97,7 @@ class KlipperScreen(Gtk.Window):
try:
super().__init__(title="KlipperScreen")
except Exception as e:
logging.exception(e)
logging.exception(f"{e}\n\n{traceback.format_exc()}")
raise RuntimeError from e
self.blanking_time = 600
self.use_dpms = True
@ -281,7 +281,7 @@ class KlipperScreen(Gtk.Window):
try:
self.panels[panel_name] = self._load_panel(panel).Panel(self, title, **kwargs)
except Exception as e:
self.show_error_modal(f"Unable to load panel {panel}", f"{e}")
self.show_error_modal(f"Unable to load panel {panel}", f"{e}\n\n{traceback.format_exc()}")
return
elif panel_name in self.panels_reinit:
logging.info("Reinitializing panel")
@ -290,7 +290,7 @@ class KlipperScreen(Gtk.Window):
self._cur_panels.append(panel_name)
self.attach_panel(panel_name)
except Exception as e:
logging.exception(f"Error attaching panel:\n{e}")
logging.exception(f"Error attaching panel:\n{e}\n\n{traceback.format_exc()}")
def attach_panel(self, panel):
self.base_panel.add_content(self.panels[panel])
@ -417,7 +417,7 @@ class KlipperScreen(Gtk.Window):
with open(theme_style_conf) as f:
style_options.update(json.load(f))
except Exception as e:
logging.error(f"Unable to parse custom template conf file:\n{e}")
logging.error(f"Unable to parse custom template conf file:\n{e}\n\n{traceback.format_exc()}")
self.gtk.color_list = style_options['graph_colors']
@ -777,7 +777,7 @@ class KlipperScreen(Gtk.Window):
j2_temp = self.env.from_string(text)
text = j2_temp.render()
except Exception as e:
logging.debug(f"Error parsing jinja for confirm_send_action\n{e}")
logging.debug(f"Error parsing jinja for confirm_send_action\n{e}\n\n{traceback.format_exc()}")
label = Gtk.Label()
label.set_markup(text)
@ -1051,7 +1051,7 @@ def main():
try:
win = KlipperScreen(args, version)
except Exception as e:
logging.exception("Failed to initialize window")
logging.exception(f"Failed to initialize window\n{e}\n\n{traceback.format_exc()}")
raise RuntimeError from e
win.connect("destroy", Gtk.main_quit)
win.show_all()
@ -1062,5 +1062,5 @@ if __name__ == "__main__":
try:
main()
except Exception as ex:
logging.exception(f"Fatal error in main loop:\n{ex}")
logging.exception(f"Fatal error in main loop:\n{ex}\n\n{traceback.format_exc()}")
sys.exit(1)