refactor: log swallowed exceptions across src/

Replace silent swallow-excepts (pass/return/continue) with
logger.warning recording the caught error, preserving behaviour.
This commit is contained in:
sankalp committed 2026-07-14 13:02:21 +05:45
1 parent c0a4b1b792
commit f72542a231
49 files changed
+1004 -363

No files matched your search

+8 -4
View File
@@ -535,8 +535,10 @@ class BluetoothConnections(Box):
self.other_devices_scrolled.height_animator.disconnect(
self._anim_finished_handler
)
except Exception:
pass
except Exception as e:
logger.warning(
f"[bluetooth] self.other_devices_scrolled.height_animator.disconnect( s... failed: {e}"
)
self._anim_finished_handler = None
def _refresh_after_animation(self):
@@ -558,8 +560,10 @@ class BluetoothConnections(Box):
spawn_detached(["blueman-manager"])
if self.parent and hasattr(self.parent, "hide_controlcenter"):
self.parent.hide_controlcenter()
except FileNotFoundError:
pass
except FileNotFoundError as e:
logger.warning(
f"[bluetooth] spawn_detached(['blueman-manager']) failed: {e}"
)
except Exception as e:
logger.error(f"[Bluetooth] Failed to open bluetooth settings: {e}")
+12 -6
View File
@@ -528,8 +528,10 @@ class PlayerBox(Box):
self.position_label.set_label(
self.length_str(self.player.position or 0)
)
except Exception:
pass
except Exception as e:
logger.warning(
f"[expanded_player] metadata = self.player._player.props.metadata failed: {e}"
)
def _poll_initial_metadata(self):
if self.exit:
@@ -724,8 +726,10 @@ class PlayerBox(Box):
if self.player and not self.exit:
try:
self.player.seek_position(value)
except Exception:
pass
except Exception as e:
logger.warning(
f"[expanded_player] self.player.seek_position(value) failed: {e}"
)
if hasattr(self, "_seek_timeout") and self._seek_timeout:
from fabric.utils import GLib
@@ -763,8 +767,10 @@ class PlayerBox(Box):
self.seek_bar.set_range(0, duration / 1_000_000)
self.length_label.set_label(self.length_str(duration))
return True
except Exception:
pass
except Exception as e:
logger.warning(
f"[expanded_player] duration = self._cached_duration or self.player.length or 0 failed: {e}"
)
return False
def _on_seek_bar_realized(self, widget):
+4 -2
View File
@@ -471,8 +471,10 @@ class PlayerBox(Box):
if "xesam:artist" in keys and metadata["xesam:artist"]
else "No Artist"
)
except Exception:
pass
except Exception as e:
logger.warning(
f"[player] metadata = self.player._player.props.metadata failed: {e}"
)
def update_buttons(self, player_buttons, show_buttons):
if show_buttons and len(player_buttons) > 1:
+8 -4
View File
@@ -417,8 +417,10 @@ class WifiConnections(Box):
self.other_networks_scrolled.height_animator.disconnect(
self._anim_finished_handler
)
except Exception:
pass
except Exception as e:
logger.warning(
f"[wifi] self.other_networks_scrolled.height_animator.disconnect( ... failed: {e}"
)
self._anim_finished_handler = None
def _refresh_after_animation(self):
@@ -477,8 +479,10 @@ class WifiConnections(Box):
spawn_detached(["nm-connection-editor"])
if self.parent and hasattr(self.parent, "hide_controlcenter"):
self.parent.hide_controlcenter()
except FileNotFoundError:
pass
except FileNotFoundError as e:
logger.warning(
f"[wifi] spawn_detached(['nm-connection-editor']) failed: {e}"
)
except Exception as e:
logger.error(f"[WiFi] Failed to open network settings: {e}")