From 88859adc0c87a2261d39343daab2290dd6b3eb0e Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Wed, 30 May 2007 22:11:24 +0000 Subject: added listener support to queues, also added support for non version specific tests git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@542955 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/delegate.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'python/qpid/delegate.py') diff --git a/python/qpid/delegate.py b/python/qpid/delegate.py index 90e5c1edc8..8f5033e485 100644 --- a/python/qpid/delegate.py +++ b/python/qpid/delegate.py @@ -21,9 +21,12 @@ Delegate implementation intended for use with the peer module. """ -import threading, inspect +import threading, inspect, traceback, sys from connection import Method, Request, Response +def _handler_name(method): + return "%s_%s" % (method.klass.name, method.name) + class Delegate: def __init__(self): @@ -36,11 +39,15 @@ class Delegate: try: handler = self.handlers[method] except KeyError: - name = "%s_%s" % (method.klass.name, method.name) + name = _handler_name(method) handler = getattr(self, name) self.handlers[method] = handler - return handler(channel, frame) + try: + return handler(channel, frame) + except: + print >> sys.stderr, "Error in handler: %s\n\n%s" % \ + (_handler_name(method), traceback.format_exc()) def close(self, reason): print "Connection closed: %s" % reason -- cgit v1.2.1