apply TRY lint

This commit is contained in:
Jörg Thalheim
2024-09-03 17:56:59 +02:00
parent 68d777166a
commit 403b9cf2cc
26 changed files with 70 additions and 49 deletions

View File

@@ -60,10 +60,11 @@ class EmptySplash(Gtk.Box):
def load_image(self, file_path: str) -> GdkPixbuf.Pixbuf | None:
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file(file_path)
return pixbuf
except Exception as e:
log.error(f"Failed to load image: {e}")
except Exception:
log.exception("Failed to load image")
return None
else:
return pixbuf
def _on_join(self, button: Gtk.Button, entry: Gtk.Entry) -> None:
"""

View File

@@ -280,8 +280,8 @@ class VMObject(GObject.Object):
if not self._log_file:
try:
self._log_file = Path(proc.out_file).open() # noqa: SIM115
except Exception as ex:
log.exception(ex)
except Exception:
log.exception(f"Failed to open log file {proc.out_file}")
self._log_file = None
return GLib.SOURCE_REMOVE