summaryrefslogtreecommitdiff
path: root/slixmpp/xmlstream
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-23 17:43:35 +0100
committermathieui <mathieui@mathieui.net>2015-02-23 17:43:35 +0100
commit74b4ea20bf369aec8196fd65cc80e717198a37bb (patch)
tree5a0332e7af99e9fddd0c2c2d101c9605694365dd /slixmpp/xmlstream
parent11fbaa42418300a5dda07799748f2bf1d67bdcdb (diff)
downloadslixmpp-74b4ea20bf369aec8196fd65cc80e717198a37bb.tar.gz
slixmpp-74b4ea20bf369aec8196fd65cc80e717198a37bb.tar.bz2
slixmpp-74b4ea20bf369aec8196fd65cc80e717198a37bb.tar.xz
slixmpp-74b4ea20bf369aec8196fd65cc80e717198a37bb.zip
Add back stanza-specific exception handlers
(fixes the test suite too)
Diffstat (limited to 'slixmpp/xmlstream')
-rw-r--r--slixmpp/xmlstream/xmlstream.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py
index 959169d1..aec89c7f 100644
--- a/slixmpp/xmlstream/xmlstream.py
+++ b/slixmpp/xmlstream/xmlstream.py
@@ -706,6 +706,7 @@ class XMLStream(asyncio.BaseProtocol):
handlers = self.__event_handlers.get(name, [])
for handler in handlers:
handler_callback, disposable = handler
+ old_exception = getattr(data, 'exception', None)
# If the callback is a coroutine, schedule it instead of
# running it directly
@@ -715,13 +716,19 @@ class XMLStream(asyncio.BaseProtocol):
try:
yield from cb(data)
except Exception as e:
- self.exception(e)
+ if old_exception:
+ old_exception(e)
+ else:
+ self.exception(e)
asyncio.async(handler_callback_routine(handler_callback))
else:
try:
handler_callback(data)
except Exception as e:
- self.exception(e)
+ if old_exception:
+ old_exception(e)
+ else:
+ self.exception(e)
if disposable:
# If the handler is disposable, we will go ahead and
# remove it now instead of waiting for it to be