diff libervia/server/server.py @ 1126:7cd89277a129

server: fixed missing backend detection
author Goffi <goffi@goffi.org>
date Fri, 31 Aug 2018 18:08:06 +0200
parents 28e3eb3bb217
children 9234f29053b0
line wrap: on
line diff
--- a/libervia/server/server.py	Fri Aug 31 18:05:15 2018 +0200
+++ b/libervia/server/server.py	Fri Aug 31 18:08:06 2018 +0200
@@ -1635,11 +1635,7 @@
         self.ns_map = {}  # map of short name to namespaces
 
         ## bridge ##
-        try:
-            self.bridge = Bridge()
-        except BridgeExceptionNoService:
-            print(u"Can't connect to SàT backend, are you sure it's launched ?")
-            sys.exit(1)
+        self.bridge = Bridge()
         self.bridge.bridgeConnect(callback=self._bridgeCb, errback=self._bridgeEb)
 
     def _namespacesGetCb(self, ns_map):
@@ -1788,8 +1784,12 @@
         self.initialised.addCallback(self.backendReady)
         self.initialised.addErrback(self.initEb)
 
-    def _bridgeEb(self, failure):
-        log.error(u"Can't connect to bridge: {}".format(failure))
+    def _bridgeEb(self, failure_):
+        if isinstance(failure_, BridgeExceptionNoService):
+            print(u"Can't connect to SàT backend, are you sure it's launched ?")
+        else:
+            log.error(u"Can't connect to bridge: {}".format(failure))
+        sys.exit(1)
 
     @property
     def version(self):