Go to the latest version of this document.

# ``twisted`.`words`.`protocols`.`jabber`.`error``

module documentation
(source)

XMPP Error support.

Exception | `BaseError` | Base class for XMPP error exceptions.
Exception | `StanzaError` | Stanza Error exception.
Exception | `StreamError` | Stream Error exception.
Function | `exceptionFromStanza` | Build an exception object from an error stanza.
Function | `exceptionFromStreamError` | Build an exception object from a stream error.
Constant | `CODES_TO_CONDITIONS` | Undocumented
Constant | `NS_XML` | Undocumented
Constant | `NS_XMPP_STANZAS` | Undocumented
Constant | `NS_XMPP_STREAMS` | Undocumented
Constant | `STANZA_CONDITIONS` | Undocumented
Function | `_parseError` | Parses an error element.

def exceptionFromStanza(stanza): (source)

Build an exception object from an error stanza.

Parameters
stanza:`domish.Element` | the error stanza

Returns
`StanzaError` | the generated exception object

def exceptionFromStreamError(element): (source)

Build an exception object from a stream error.

Parameters
element:`domish.Element` | the stream error

Returns
`StreamError` | the generated exception object

CODES_TO_CONDITIONS: `dict` = (source)

Undocumented

Value

    {'302': ('gone', 'modify'),
     '400': ('bad-request', 'modify'),
     '401': ('not-authorized', 'auth'),
     '402': ('payment-required', 'auth'),
     '403': ('forbidden', 'auth'),
     '404': ('item-not-found', 'cancel'),
     '405': ('not-allowed', 'cancel'),
    ...

NS_XML: `str` = (source)

Undocumented

Value

    'http://www.w3.org/XML/1998/namespace'

NS_XMPP_STANZAS: `str` = (source)

Undocumented

Value

    'urn:ietf:params:xml:ns:xmpp-stanzas'

NS_XMPP_STREAMS: `str` = (source)

Undocumented

Value

    'urn:ietf:params:xml:ns:xmpp-streams'

STANZA_CONDITIONS: `dict` = (source)

Undocumented

Value

    {'bad-request': {'code': '400', 'type': 'modify'},
     'conflict': {'code': '409', 'type': 'cancel'},
     'feature-not-implemented': {'code': '501', 'type': 'cancel'},
     'forbidden': {'code': '403', 'type': 'auth'},
     'gone': {'code': '302', 'type': 'modify'},
     'internal-server-error': {'code': '500', 'type': 'wait'},
     'item-not-found': {'code': '404', 'type': 'cancel'},
    ...

def _parseError(error, errorNamespace): (source)

Parses an error element.

Parameters
error:`domish.Element` | The error element to be parsed
errorNamespace:`str` | The namespace of the elements that hold the error condition and text.

Returns
`dict` | Dictionary with extracted error information. If present, keys `condition`, `text`, `textLang` have a string value, and `appCondition` has an `domish.Element` value.