Merge pull request #738 from oberstet/fix_737

fix it
This commit is contained in:
Tobias Oberstein 2016-09-21 08:07:21 +02:00 committed by GitHub
commit 65087e313e
2 changed files with 12 additions and 11 deletions

View File

@ -78,6 +78,8 @@ class ApplicationRunner(object):
connecting to a WAMP router. connecting to a WAMP router.
""" """
log = txaio.make_logger()
def __init__(self, url, realm, extra=None, serializers=None, ssl=None): def __init__(self, url, realm, extra=None, serializers=None, ssl=None):
""" """
:param url: The WebSocket URL of the WAMP router to connect to (e.g. `ws://somehost.com:8090/somepath`) :param url: The WebSocket URL of the WAMP router to connect to (e.g. `ws://somehost.com:8090/somepath`)
@ -121,9 +123,12 @@ class ApplicationRunner(object):
cfg = ComponentConfig(self.realm, self.extra) cfg = ComponentConfig(self.realm, self.extra)
try: try:
session = make(cfg) session = make(cfg)
except Exception: except Exception as e:
self.log.failure("App session could not be created! ") self.log.error('ApplicationSession could not be instantiated: {}'.format(e))
asyncio.get_event_loop().stop() loop = asyncio.get_event_loop()
if loop.is_running():
loop.stop()
raise
else: else:
return session return session

View File

@ -168,15 +168,11 @@ class ApplicationRunner(object):
cfg = ComponentConfig(self.realm, self.extra) cfg = ComponentConfig(self.realm, self.extra)
try: try:
session = make(cfg) session = make(cfg)
except Exception as e: except Exception:
if start_reactor: self.log.failure('ApplicationSession could not be instantiated: {log_failure.value}')
# the app component could not be created .. fatal if start_reactor and reactor.running:
self.log.error("{err}", err=e)
reactor.stop() reactor.stop()
else: raise
# if we didn't start the reactor, it's up to the
# caller to deal with errors
raise
else: else:
return session return session
else: else: