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.
"""
log = txaio.make_logger()
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`)
@ -121,9 +123,12 @@ class ApplicationRunner(object):
cfg = ComponentConfig(self.realm, self.extra)
try:
session = make(cfg)
except Exception:
self.log.failure("App session could not be created! ")
asyncio.get_event_loop().stop()
except Exception as e:
self.log.error('ApplicationSession could not be instantiated: {}'.format(e))
loop = asyncio.get_event_loop()
if loop.is_running():
loop.stop()
raise
else:
return session

View File

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