From e9b07e32bb44464d71371eff8b93be9635777bbd Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 31 Jan 2021 17:00:42 +0100 Subject: exceptions: add a PresenceError exception --- slixmpp/exceptions.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'slixmpp/exceptions.py') diff --git a/slixmpp/exceptions.py b/slixmpp/exceptions.py index 0486666e..5ec6e7e1 100644 --- a/slixmpp/exceptions.py +++ b/slixmpp/exceptions.py @@ -101,3 +101,17 @@ class IqError(XMPPError): #: The :class:`~slixmpp.stanza.iq.Iq` error result stanza. self.iq = iq + + +class PresenceError(XMPPError): + """ + An exception raised in specific circumstances for presences + of type 'error' received. + """ + def __init__(self, pres): + super().__init__( + condition=pres['error']['condition'], + text=pres['error']['text'], + etype=pres['error']['type'], + ) + self.presence = pres -- cgit v1.2.3