pyxmpp.error.StanzaErrorNode

Package pyxmpp :: Module error :: Class StanzaErrorNode |
[show private | hide private]
[frames | no frames]

## Class StanzaErrorNode

    ErrorNode --+
                |
               StanzaErrorNode

Stanza error element.

Method Summary
| ``__init__`(self, xmlnode_or_cond, error_type, copy, parent)` Initialize a StreamErrorNode object.
`unicode` | ``get_message`(self)` Get the message for the error.
`unicode` | ``get_type`(self)` Get the error type.
| ``upgrade`(self)` Upgrade a legacy error element to the XMPP compliant one.
Inherited from ErrorNode
| ``__del__`(self)`
`libxml2.xmlNode` | ``add_custom_condition`(self, ns, cond, content)` Add custom condition element to the error.
| ``downgrade`(self)` Downgrade an XMPP error element to the legacy format.
| ``free`(self)` Free the associated XML node.
| ``free_borrowed`(self)` Free the associated "borrowed" XML node.
`libxml2.xmlNode` | ``get_condition`(self, ns)` Get the condition element of the error.
`unicode` | ``get_text`(self)` Get the description text from the error element.
`bool` | ``is_legacy`(self)` Check if the error node is a legacy error element.
`str` | ``serialize`(self)` Serialize the element node.
| ``xpath_eval`(self, expr, namespaces)` Evaluate XPath expression on the error element.

Method Details

### __init__(self, xmlnode_or_cond, error_type=None, copy=1, parent=None) (Constructor) Initialize a StreamErrorNode object. Parameters: `xmlnode_or_cond` - XML node to be wrapped into this object or the primary (defined by XMPP specification) error condition name. (type=`libxml2.xmlNode` or `unicode`) `error_type` - type of the error, one of: 'cancel', 'continue', 'modify', 'auth', 'wait'. (type=`unicode`) `copy` - When `True` then the XML node will be copied, otherwise it is only borrowed. (type=`bool`) `parent` - Parent node for the XML node to be copied or created. (type=`libxml2.xmlNode`) Overrides: `pyxmpp.error.ErrorNode.__init__`

### get_message(self) Get the message for the error. Returns: the error message. (type=`unicode`)

### get_type(self) Get the error type. Returns: type of the error. (type=`unicode`)

### upgrade(self) Upgrade a legacy error element to the XMPP compliant one. Use the error code provided to select the condition and the <error/> CDATA for the error text. Overrides: `pyxmpp.error.ErrorNode.upgrade`