fix(dbus): Add error handling for DBus publishing and main loop
Wrap DBus publishing and main loop execution in try-except blocks to capture and log failures. This ensures better visibility into errors and prevents silent failures during runtime.
This commit is contained in:
@@ -34,12 +34,19 @@ class BusProvider(Thread):
|
||||
def run(self):
|
||||
log.debug("enter BusProvider.run")
|
||||
|
||||
try:
|
||||
self._bus.publish(
|
||||
REVPI_DBUS_NAME,
|
||||
InterfacePiControl(self.picontrol_device, self.config_rsc),
|
||||
)
|
||||
except Exception as e:
|
||||
log.error(f"can not publish dbus {REVPI_DBUS_NAME}: {e}")
|
||||
|
||||
try:
|
||||
self._loop.run()
|
||||
except Exception as e:
|
||||
log.error(f"can not run dbus mainloop: {e}")
|
||||
|
||||
log.debug("leave BusProvider.run")
|
||||
|
||||
def stop(self):
|
||||
|
||||
Reference in New Issue
Block a user