From 20d053807da1f59a2f7507fb7bb3845d31e27445 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 1 Jun 2011 15:28:33 -0700 Subject: [PATCH] IqTimeout now references the original sent stanza. A little extra bit of docs for IqError. --- sleekxmpp/exceptions.py | 8 ++++++++ sleekxmpp/stanza/iq.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sleekxmpp/exceptions.py b/sleekxmpp/exceptions.py index 72c0860..8329a3c 100644 --- a/sleekxmpp/exceptions.py +++ b/sleekxmpp/exceptions.py @@ -61,7 +61,15 @@ class IqTimeout(Exception): received within the alloted time window. """ + def __init__(self, iq): + self.iq = iq + class IqError(Exception): + """ + An exception raised when an Iq stanza of type 'error' is received + after making a blocking send call. + """ + def __init__(self, iq): self.iq = iq diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py index 71419bc..f05dad1 100644 --- a/sleekxmpp/stanza/iq.py +++ b/sleekxmpp/stanza/iq.py @@ -200,7 +200,7 @@ class Iq(RootStanza): StanzaBase.send(self, now=now) result = waitfor.wait(timeout) if not result: - raise IqTimeout() + raise IqTimeout(self) if result['type'] == 'error': raise IqError(result) return result