summaryrefslogtreecommitdiff
path: root/sleekxmpp/stanza/iq.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2011-08-12 16:35:15 -0700
committerNathan Fritz <fritzy@netflint.net>2011-08-12 16:35:15 -0700
commitbd8c110f00a41917839a0578de68b80c39ee6e16 (patch)
treecc44410ba6e6efe7cfcf1decc8f1b1d8b2692aa7 /sleekxmpp/stanza/iq.py
parent0050c5112428939346397a4d2edfeb313c0fd497 (diff)
parentd7fe724145c2e01d1028dab773fb49414c6856dd (diff)
downloadslixmpp-bd8c110f00a41917839a0578de68b80c39ee6e16.tar.gz
slixmpp-bd8c110f00a41917839a0578de68b80c39ee6e16.tar.bz2
slixmpp-bd8c110f00a41917839a0578de68b80c39ee6e16.tar.xz
slixmpp-bd8c110f00a41917839a0578de68b80c39ee6e16.zip
Merge branch 'exceptions' into develop
Diffstat (limited to 'sleekxmpp/stanza/iq.py')
-rw-r--r--sleekxmpp/stanza/iq.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py
index 4a12a87e..f05dad17 100644
--- a/sleekxmpp/stanza/iq.py
+++ b/sleekxmpp/stanza/iq.py
@@ -11,6 +11,7 @@ from sleekxmpp.stanza.rootstanza import RootStanza
from sleekxmpp.xmlstream import StanzaBase, ET
from sleekxmpp.xmlstream.handler import Waiter, Callback
from sleekxmpp.xmlstream.matcher import MatcherId
+from sleekxmpp.exceptions import IqTimeout, IqError
class Iq(RootStanza):
@@ -197,7 +198,12 @@ class Iq(RootStanza):
waitfor = Waiter('IqWait_%s' % self['id'], MatcherId(self['id']))
self.stream.register_handler(waitfor)
StanzaBase.send(self, now=now)
- return waitfor.wait(timeout)
+ result = waitfor.wait(timeout)
+ if not result:
+ raise IqTimeout(self)
+ if result['type'] == 'error':
+ raise IqError(result)
+ return result
else:
return StanzaBase.send(self, now=now)