summaryrefslogtreecommitdiff
path: root/sleekxmpp/exceptions.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-08-11 18:21:12 -0400
committerLance Stout <lancestout@gmail.com>2010-08-11 18:21:12 -0400
commitc09e9c702c114f76d6cbfd9d7fb1a19cefa5a1e5 (patch)
tree3ec3d0bc7b65c78365fd5fdc30f4cd200fe7aea5 /sleekxmpp/exceptions.py
parent48ba7292bcbc5207f08766ed3a855e16e2bf11d7 (diff)
downloadslixmpp-c09e9c702c114f76d6cbfd9d7fb1a19cefa5a1e5.tar.gz
slixmpp-c09e9c702c114f76d6cbfd9d7fb1a19cefa5a1e5.tar.bz2
slixmpp-c09e9c702c114f76d6cbfd9d7fb1a19cefa5a1e5.tar.xz
slixmpp-c09e9c702c114f76d6cbfd9d7fb1a19cefa5a1e5.zip
Updated sleekxmpp.exceptions with PEP8 style and docs.
Diffstat (limited to 'sleekxmpp/exceptions.py')
-rw-r--r--sleekxmpp/exceptions.py45
1 files changed, 37 insertions, 8 deletions
diff --git a/sleekxmpp/exceptions.py b/sleekxmpp/exceptions.py
index bbbd69d5..40217ef6 100644
--- a/sleekxmpp/exceptions.py
+++ b/sleekxmpp/exceptions.py
@@ -3,14 +3,43 @@
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
-See the file LICENSE for copying permission.
+ See the file LICENSE for copying permission.
"""
class XMPPError(Exception):
- def __init__(self, condition='undefined-condition', text=None, etype=None, extension=None, extension_ns=None, extension_args=None):
- self.condition = condition
- self.text = text
- self.etype = etype
- self.extension = extension
- self.extension_ns = extension_ns
- self.extension_args = extension_args
+
+ """
+ A generic exception that may be raised while processing an XMPP stanza
+ to indicate that an error response stanza should be sent.
+
+ The exception method for stanza objects extending RootStanza will create
+ an error stanza and initialize any additional substanzas using the
+ extension information included in the exception.
+
+ Meant for use in SleekXMPP plugins and applications using SleekXMPP.
+ """
+
+ def __init__(self, condition='undefined-condition', text=None, etype=None,
+ extension=None, extension_ns=None, extension_args=None):
+ """
+ Create a new XMPPError exception.
+
+ Extension information can be included to add additional XML elements
+ to the generated error stanza.
+
+ Arguments:
+ condition -- The XMPP defined error condition.
+ text -- Human readable text describing the error.
+ etype -- The XMPP error type, such as cancel or modify.
+ extension -- Tag name of the extension's XML content.
+ extension_ns -- XML namespace of the extensions' XML content.
+ extension_args -- Content and attributes for the extension
+ element. Same as the additional arguments to
+ the ET.Element constructor.
+ """
+ self.condition = condition
+ self.text = text
+ self.etype = etype
+ self.extension = extension
+ self.extension_ns = extension_ns
+ self.extension_args = extension_args