Mercurial > libervia-backend
diff frontends/src/bridge/DBus.py @ 627:d207c2186519
core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised:
- new BridgeInitError and BridgeExceptionNoService are in core.exceptions
- D-Bus NotSupported is catched in bridge, and launch a BridgeInitError
- BridgeInitError stop SàT core, jp, and quick_frontends with an explanation message.
fix bug 27
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 21 Jun 2013 02:00:37 +0200 |
parents | 84a6e83157c2 |
children | ca2cae6b2c6d |
line wrap: on
line diff
--- a/frontends/src/bridge/DBus.py Thu Jun 20 17:44:27 2013 +0200 +++ b/frontends/src/bridge/DBus.py Fri Jun 21 02:00:37 2013 +0200 @@ -20,6 +20,7 @@ from bridge_frontend import BridgeFrontend import dbus from logging import debug, error +from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError from dbus.mainloop.glib import DBusGMainLoop DBusGMainLoop(set_as_default=True) @@ -31,10 +32,6 @@ const_PLUGIN_SUFFIX = ".plugin" -class BridgeExceptionNoService(Exception): - pass - - class DBusBridgeFrontend(BridgeFrontend): def __init__(self): try: @@ -48,6 +45,9 @@ except dbus.exceptions.DBusException, e: if e._dbus_error_name == 'org.freedesktop.DBus.Error.ServiceUnknown': raise BridgeExceptionNoService + elif e._dbus_error_name == 'org.freedesktop.DBus.Error.NotSupported': + print u"D-Bus is not launched, please see README to see instructions on how to launch it" + raise BridgeInitError else: raise e #props = self.db_core_iface.getProperties()