Mercurial > libervia-web
changeset 1594:93abef9a3548
server: catch `DBusException` and retry to connect in this case.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 13 Dec 2023 22:03:49 +0100 |
parents | c6976c5b85a1 |
children | 7941444c1671 |
files | libervia/web/server/server.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/web/server/server.py Mon Dec 11 00:43:06 2023 +0100 +++ b/libervia/web/server/server.py Wed Dec 13 22:03:49 2023 +0100 @@ -27,6 +27,7 @@ import urllib.parse import urllib.request +from dbus.exceptions import DBusException from twisted.application import service from twisted.internet import defer, inotify, reactor from twisted.python import failure @@ -648,7 +649,10 @@ self.initialised.addCallback(lambda __: defer.ensureDeferred(self.backend_ready())) def _bridge_eb(self, failure_): - if isinstance(failure_, BridgeExceptionNoService): + if ( + isinstance(failure_, BridgeExceptionNoService) + or isinstance(failure_, DBusException) + ): if self._bridge_retry: if self._bridge_retry < 0: print(_("Can't connect to bridge, will retry indefinitely. " @@ -665,9 +669,9 @@ self.bridge.bridge_connect(callback=self._bridge_cb, errback=self._bridge_eb) return - print("Can't connect to SàT backend, are you sure it's launched ?") + print("Can't connect to Libervia backend, are you sure it's launched?") else: - log.error("Can't connect to bridge: {}".format(failure)) + log.exception("Can't connect to bridge") sys.exit(1) @property