diff src/server/server.py @ 1003:05cc33d8e328

server: better error message on init issue / menu_json trouble + stop reactor in this case.
author Goffi <goffi@goffi.org>
date Fri, 05 Jan 2018 16:30:05 +0100
parents f88325b56a6a
children d0b27d1e2d50
line wrap: on
line diff
--- a/src/server/server.py	Fri Jan 05 16:30:05 2018 +0100
+++ b/src/server/server.py	Fri Jan 05 16:30:05 2018 +0100
@@ -1488,12 +1488,16 @@
         self.renderer = template.Renderer(self)
         self.putChild('templates', ProtectedFile(self.renderer.base_dir))
 
+    def initEb(self, failure):
+        log.error(_(u"Init error: {msg}").format(msg=failure))
+        reactor.stop()
+        return failure
 
     def _bridgeCb(self):
         self.bridge.getReady(lambda: self.initialised.callback(None),
                              lambda failure: self.initialised.errback(Exception(failure)))
         self.initialised.addCallback(self.backendReady)
-        self.initialised.addErrback(lambda failure: log.error(u"Init error: %s" % failure))
+        self.initialised.addErrback(self.initEb)
 
     def _bridgeEb(self, failure):
         log.error(u"Can't connect to bridge: {}".format(failure))