Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Leger2014-03-13 06:43:32 -0400
committerFrederic Leger2014-03-13 11:06:58 -0400
commitc5e711d87dbf7c682b0d1619dc636ca120f69a58 (patch)
treefe1e4177e45e4c850a4f67ac590f3f9da8c9ce1b
parent4c41b370106e65a91f2e6a2694df631d26b6f5ef (diff)
downloadorg.eclipse.tcf-c5e711d87dbf7c682b0d1619dc636ca120f69a58.tar.gz
org.eclipse.tcf-c5e711d87dbf7c682b0d1619dc636ca120f69a58.tar.xz
org.eclipse.tcf-c5e711d87dbf7c682b0d1619dc636ca120f69a58.zip
Improve debug output in the case of exception.
Add the stacktrace at the time of the exception.
-rw-r--r--python/src/tcf/channel/AbstractChannel.py26
-rw-r--r--python/src/tcf/transport.py4
2 files changed, 18 insertions, 12 deletions
diff --git a/python/src/tcf/channel/AbstractChannel.py b/python/src/tcf/channel/AbstractChannel.py
index e700af122..8cb2b3e7b 100644
--- a/python/src/tcf/channel/AbstractChannel.py
+++ b/python/src/tcf/channel/AbstractChannel.py
@@ -139,13 +139,11 @@ class ReaderThread(threading.Thread):
class AbstractChannel(object):
"""
AbstractChannel implements communication link connecting two end points
- (peers).
- The channel asynchronously transmits messages: commands, results and
- events.
+ (peers). The channel asynchronously transmits messages: commands, results
+ and events. Clients can subclass AbstractChannel to support particular
+ transport (wire) protocol.
- Clients can subclass AbstractChannel to support particular transport (wire)
- protocol.
- Also, see StreamChannel for stream oriented transport protocols.
+ .. see also: see StreamChannel for stream oriented transport protocols.
"""
def __init__(self, remote_peer, local_peer=None):
@@ -240,6 +238,7 @@ class AbstractChannel(object):
tokenID = m.token.getID()
l.onMessageSent(m.type, tokenID, m.service, m.name, m.data)
except Exception as x:
+ x.tb = sys.exc_info()[2]
protocol.log("Exception in channel listener", x)
def start(self):
@@ -268,7 +267,7 @@ class AbstractChannel(object):
Redirect this channel to given peer using this channel remote peer
locator service as a proxy.
@param peer_id - peer that will become new remote communication
- endpoint of this channel
+ endpoint of this channel.
"""
peerMap = {}
peerMap[peer.ATTR_ID] = peer_id
@@ -279,7 +278,7 @@ class AbstractChannel(object):
Redirect this channel to given peer using this channel remote peer
locator service as a proxy.
@param peer_attrs - peer that will become new remote communication
- endpoint of this channel
+ endpoint of this channel.
"""
if isinstance(peer_attrs, str):
# support for redirect(peerId)
@@ -485,6 +484,7 @@ class AbstractChannel(object):
try:
self.proxy.onChannelClosed(error)
except Exception as x:
+ x.tb = sys.exc_info()[2]
protocol.log("Exception in channel listener", x)
channel = self
@@ -516,15 +516,17 @@ class AbstractChannel(object):
try:
l.onChannelClosed(error)
except Exception as x:
+ x.tb = sys.exc_info()[2]
protocol.log("Exception in channel listener", x)
- elif error:
- protocol.log("TCF channel terminated", error)
if channel.trace_listeners:
for l in channel.trace_listeners:
try:
l.onChannelClosed(error)
except Exception as x:
+ x.tb = sys.exc_info()[2]
protocol.log("Exception in channel listener", x)
+ if error:
+ protocol.log("TCF channel terminated", error)
protocol.invokeLater(Runnable())
def getCongestion(self):
@@ -676,6 +678,7 @@ class AbstractChannel(object):
l.onMessageReceived(m.type, messageID, m.service, m.name,
m.data)
except Exception as x:
+ x.tb = sys.exc_info()[2]
protocol.log("Exception in channel listener", x)
def __handleInput(self, msg):
@@ -743,12 +746,13 @@ class AbstractChannel(object):
if not self.registered_with_trasport:
transport.channelOpened(self)
self.registered_with_trasport = True
- for l in self.channel_listeners:
+ for l in tuple(self.channel_listeners):
if not l:
break
try:
l.onChannelOpened()
except Exception as x:
+ x.tb = sys.exc_info()[2]
protocol.log("Exception in channel listener",
x)
self.notifying_channel_opened = False
diff --git a/python/src/tcf/transport.py b/python/src/tcf/transport.py
index cab35dfb9..f46df217a 100644
--- a/python/src/tcf/transport.py
+++ b/python/src/tcf/transport.py
@@ -83,10 +83,12 @@ def openChannel(peer):
def channelOpened(channel):
assert channel not in _channels
_channels.append(channel)
- for l in _listeners:
+ for l in tuple(_listeners):
try:
l.onChannelOpen(channel)
except Exception as x:
+ import sys
+ x.tb = sys.exc_info()[2]
protocol.log("Exception in channel listener", x)

Back to the top