summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/rootstanza.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-02-11 15:20:26 -0500
committerLance Stout <lancestout@gmail.com>2011-02-11 15:20:26 -0500
commit0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8 (patch)
tree20bf5d0037cdd33bf45460c7001dd593643293b0 /sleekxmpp/stanza/rootstanza.py
parentc4b1212c44e0758c6361ca46c6c3a90e27ac876f (diff)
downloadslixmpp-0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8.tar.gz
slixmpp-0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8.tar.bz2
slixmpp-0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8.tar.xz
slixmpp-0d326383799a7d7bb69fec9dcd1eaf9e1a64eab8.zip
XMPPError exceptions can keep a stanza's contents.
This allows exceptions to include the original content of a stanza in the error response by including the parameter clear=False when raising the exception.
Diffstat (limited to 'sleekxmpp/stanza/rootstanza.py')
-rw-r--r--sleekxmpp/stanza/rootstanza.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sleekxmpp/stanza/rootstanza.py b/sleekxmpp/stanza/rootstanza.py
index 8123c5f8..bc11476e 100644
--- a/sleekxmpp/stanza/rootstanza.py
+++ b/sleekxmpp/stanza/rootstanza.py
@@ -43,8 +43,8 @@ class RootStanza(StanzaBase):
Arguments:
e -- Exception object
"""
- self.reply()
if isinstance(e, XMPPError):
+ self.reply(clear=e.clear)
# We raised this deliberately
self['error']['condition'] = e.condition
self['error']['text'] = e.text
@@ -56,6 +56,7 @@ class RootStanza(StanzaBase):
self['error']['type'] = e.etype
self.send()
else:
+ self.reply()
# We probably didn't raise this on purpose, so send an error stanza
self['error']['condition'] = 'undefined-condition'
self['error']['text'] = "SleekXMPP got into trouble."