fix(src/window/osd/components): improve error handling by logging exceptions

To aid debugging and visibility of errors in OSD components.
This commit is contained in:
sankalp committed 2026-06-17 05:21:53 +05:45
1 parent 9cbde2c58f
commit b1b9dcc061
6 files changed
+20 -15

No files matched your search

+3 -2
View File
@@ -1,3 +1,4 @@
from fabric.utils import logger
import math
from fabric.audio import Audio
from utils.utils import svg_file
@@ -105,6 +106,6 @@ class AudioOSDContainer(BaseOSDContainer):
self.audio.disconnect_by_func(self._on_speaker_changed)
if self.audio.speaker:
self.audio.speaker.disconnect_by_func(self._on_speaker_stream_changed)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
super().destroy()
+5 -5
View File
@@ -1,5 +1,5 @@
from abc import abstractmethod
from fabric.utils import Gdk, GLib, invoke_repeater, remove_handler, time
from fabric.utils import Gdk, GLib, invoke_repeater, remove_handler, time, logger
from fabric.widgets.box import Box
from fabric.widgets.wayland import WaylandWindow as Window
@@ -48,16 +48,16 @@ class BaseOSDContainer(Box):
if self.last_handler:
try:
remove_handler(self.last_handler)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
self.last_handler = 0
def remove_watchdog_handler(self):
if self.watchdog_handler:
try:
GLib.source_remove(self.watchdog_handler)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
self.watchdog_handler = 0
def cleanup_all_handlers(self):
+3 -2
View File
@@ -1,3 +1,4 @@
from fabric.utils import logger
import math
from services.brightness import Brightness
from utils.utils import svg_file
@@ -64,6 +65,6 @@ class BrightnessOSDContainer(BaseOSDContainer):
self.brightness_service.disconnect_by_func(
self._on_screen_brightness_changed
)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
super().destroy()
+3 -2
View File
@@ -1,3 +1,4 @@
from fabric.utils import logger
from fabric.widgets.label import Label
from utils.utils import svg_file
from .base import BaseOSDContainer
@@ -50,6 +51,6 @@ class CapsLockOSDContainer(BaseOSDContainer):
"""Disconnect signals from CapsLock service"""
try:
self.capslock.disconnect_by_func(self._on_caps_lock_state_changed)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
super().destroy()
+3 -2
View File
@@ -1,3 +1,4 @@
from fabric.utils import logger
from fabric.widgets.label import Label
from utils.utils import svg_file
from .base import BaseOSDContainer
@@ -42,6 +43,6 @@ class KeyboardLayoutOSDContainer(BaseOSDContainer):
"""Disconnect signals from KeyboardLayout service"""
try:
self.keyboard_layout.disconnect_by_func(self._on_layout_changed)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
super().destroy()
+3 -2
View File
@@ -1,3 +1,4 @@
from fabric.utils import logger
import math
from fabric.audio import Audio
from utils.utils import svg_file
@@ -107,6 +108,6 @@ class MicrophoneOSDContainer(BaseOSDContainer):
self.audio.microphone.disconnect_by_func(
self._on_microphone_stream_changed
)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
super().destroy()