tools: ratbagd: throw an error if the system bus is unavailable
When running in a container (CircleCI), dbus may not be available. Throw one
of our errors to be consistent with our behavior when the name owner isn't
available.
@@ -111,7 +111,11 @@ class _RatbagdDBus(GObject.GObject):
GObject.GObject.__init__(self)
if _RatbagdDBus._dbus is None:
+ try:
_RatbagdDBus._dbus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
+ except GLib.Error:
+ raise RatbagdDBusUnavailable()
+
if _RatbagdDBus._dbus is None:
raise RatbagdDBusUnavailable()
