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: try:
super().__init__(title="KlipperScreen") super().__init__(title="KlipperScreen")
except Exception as e: except Exception as e:
logging.exception(e) logging.exception(f"{e}\n\n{traceback.format_exc()}")
raise RuntimeError from e raise RuntimeError from e
self.blanking_time = 600 self.blanking_time = 600
self.use_dpms = True self.use_dpms = True
@ -281,7 +281,7 @@ class KlipperScreen(Gtk.Window):
try: try:
self.panels[panel_name] = self._load_panel(panel).Panel(self, title, **kwargs) self.panels[panel_name] = self._load_panel(panel).Panel(self, title, **kwargs)
except Exception as e: 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 return
elif panel_name in self.panels_reinit: elif panel_name in self.panels_reinit:
logging.info("Reinitializing panel") logging.info("Reinitializing panel")
@ -290,7 +290,7 @@ class KlipperScreen(Gtk.Window):
self._cur_panels.append(panel_name) self._cur_panels.append(panel_name)
self.attach_panel(panel_name) self.attach_panel(panel_name)
except Exception as e: 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): def attach_panel(self, panel):
self.base_panel.add_content(self.panels[panel]) self.base_panel.add_content(self.panels[panel])
@ -417,7 +417,7 @@ class KlipperScreen(Gtk.Window):
with open(theme_style_conf) as f: with open(theme_style_conf) as f:
style_options.update(json.load(f)) style_options.update(json.load(f))
except Exception as e: 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'] self.gtk.color_list = style_options['graph_colors']
@ -777,7 +777,7 @@ class KlipperScreen(Gtk.Window):
j2_temp = self.env.from_string(text) j2_temp = self.env.from_string(text)
text = j2_temp.render() text = j2_temp.render()
except Exception as e: 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 = Gtk.Label()
label.set_markup(text) label.set_markup(text)
@ -1051,7 +1051,7 @@ def main():
try: try:
win = KlipperScreen(args, version) win = KlipperScreen(args, version)
except Exception as e: 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 raise RuntimeError from e
win.connect("destroy", Gtk.main_quit) win.connect("destroy", Gtk.main_quit)
win.show_all() win.show_all()
@ -1062,5 +1062,5 @@ if __name__ == "__main__":
try: try:
main() main()
except Exception as ex: 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) sys.exit(1)