Mercurial > libervia-web
comparison 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 |
comparison
equal
deleted
inserted
replaced
1002:990e80aa43a9 | 1003:05cc33d8e328 |
---|---|
1486 self.site = server.Site(wrapped) | 1486 self.site = server.Site(wrapped) |
1487 self.site.sessionFactory = LiberviaSession | 1487 self.site.sessionFactory = LiberviaSession |
1488 self.renderer = template.Renderer(self) | 1488 self.renderer = template.Renderer(self) |
1489 self.putChild('templates', ProtectedFile(self.renderer.base_dir)) | 1489 self.putChild('templates', ProtectedFile(self.renderer.base_dir)) |
1490 | 1490 |
1491 def initEb(self, failure): | |
1492 log.error(_(u"Init error: {msg}").format(msg=failure)) | |
1493 reactor.stop() | |
1494 return failure | |
1491 | 1495 |
1492 def _bridgeCb(self): | 1496 def _bridgeCb(self): |
1493 self.bridge.getReady(lambda: self.initialised.callback(None), | 1497 self.bridge.getReady(lambda: self.initialised.callback(None), |
1494 lambda failure: self.initialised.errback(Exception(failure))) | 1498 lambda failure: self.initialised.errback(Exception(failure))) |
1495 self.initialised.addCallback(self.backendReady) | 1499 self.initialised.addCallback(self.backendReady) |
1496 self.initialised.addErrback(lambda failure: log.error(u"Init error: %s" % failure)) | 1500 self.initialised.addErrback(self.initEb) |
1497 | 1501 |
1498 def _bridgeEb(self, failure): | 1502 def _bridgeEb(self, failure): |
1499 log.error(u"Can't connect to bridge: {}".format(failure)) | 1503 log.error(u"Can't connect to bridge: {}".format(failure)) |
1500 | 1504 |
1501 @property | 1505 @property |