diff --git a/sleekxmpp/exceptions.py b/sleekxmpp/exceptions.py index 72c0860a..8329a3c3 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 71419bc4..f05dad17 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