errors — Exception classes

Exception classes mapping to XMPP stream errors

class aioxmpp.errors.StreamError(condition, text=None)[source]
class aioxmpp.errors.StreamErrorCondition(value)[source]

Enumeration to represent a RFC 6120 stream error condition. Please see RFC 6120, section 4.9.3, for the semantics of the individual conditions.

New in version 0.10.

BAD_FORMAT = (namespaces.streams, "bad-format")
BAD_NAMESPACE_PREFIX = (namespaces.streams, "bad-namespace-prefix")
CONFLICT = (namespaces.streams, "conflict")
CONNECTION_TIMEOUT = (namespaces.streams, "connection-timeout")
HOST_GONE = (namespaces.streams, "host-gone")
HOST_UNKNOWN = (namespaces.streams, "host-unknown")
IMPROPER_ADDRESSING = (namespaces.streams, "improper-addressing")
INTERNAL_SERVER_ERROR = (namespaces.streams, "internal-server-error")
INVALID_FROM = (namespaces.streams, "invalid-from")
INVALID_NAMESPACE = (namespaces.streams, "invalid-namespace")
INVALID_XML = (namespaces.streams, "invalid-xml")
NOT_AUTHORIZED = (namespaces.streams, "not-authorized")
NOT_WELL_FORMED = (namespaces.streams, "not-well-formed")
POLICY_VIOLATION = (namespaces.streams, "policy-violation")
REMOTE_CONNECTION_FAILED = (namespaces.streams, "remote-connection-failed")
RESET = (namespaces.streams, "reset")
RESOURCE_CONSTRAINT = (namespaces.streams, "resource-constraint")
RESTRICTED_XML = (namespaces.streams, "restricted-xml")
SEE_OTHER_HOST = (namespaces.streams, "see-other-host")
SYSTEM_SHUTDOWN = (namespaces.streams, "system-shutdown")
UNDEFINED_CONDITION = (namespaces.streams, "undefined-condition")
UNSUPPORTED_ENCODING = (namespaces.streams, "unsupported-encoding")
UNSUPPORTED_FEATURE = (namespaces.streams, "unsupported-feature")
UNSUPPORTED_STANZA_TYPE = (namespaces.streams, "unsupported-stanza-type")
UNSUPPORTED_VERSION = (namespaces.streams, "unsupported-version")

Exception classes mapping to XMPP stanza errors

class aioxmpp.errors.StanzaError[source]
class aioxmpp.errors.XMPPError(condition, text=None, application_defined_condition=None)[source]

Exception representing an error defined in the XMPP protocol.

Parameters

Changed in version 0.10: As of 0.10, condition should either be a aioxmpp.ErrorCondition enumeration member or an XSO representing one of the error conditions.

For compatibility, namespace-localpart tuples indicating the tag of the defined error condition are still accepted.

Deprecated since version 0.10: Starting with aioxmpp 1.0, namespace-localpart tuples will not be accepted anymore. See the changelog for notes on the transition.

condition_obj

The aioxmpp.XSO which represents the error condition.

New in version 0.10.

condition

aioxmpp.ErrorCondition enumeration member representing the error condition.

text

Optional human-readable text describing the error further.

This is None if the text is omitted.

application_defined_condition

Optional aioxmpp.XSO which further defines the error condition.

Relevant subclasses:

aioxmpp.XMPPAuthError(condition[, text, …])

aioxmpp.XMPPModifyError(condition[, text, …])

aioxmpp.XMPPCancelError(condition[, text, …])

aioxmpp.XMPPContinueError(condition[, text, …])

aioxmpp.XMPPWaitError(condition[, text, …])

class aioxmpp.ErrorCondition(value)[source]

Enumeration to represent a RFC 6120 stanza error condition. Please see RFC 6120, section 8.3.3, for the semantics of the individual conditions.

New in version 0.10.

BAD_REQUEST = namespaces.stanzas, "bad-request"
CONFLICT = namespaces.stanzas, "conflict"
FEATURE_NOT_IMPLEMENTED = namespaces.stanzas, "feature-not-implemented"
FORBIDDEN = namespaces.stanzas, "forbidden"
GONE = namespaces.stanzas, "gone"
xso_class
new_address

The text content of the <gone/> element represtenting the URI at which the entity can now be found.

May be None if there is no such URI.

INTERNAL_SERVER_ERROR = namespaces.stanzas, "internal-server-error"
ITEM_NOT_FOUND = namespaces.stanzas, "item-not-found"
JID_MALFORMED = namespaces.stanzas, "jid-malformed"
NOT_ACCEPTABLE = namespaces.stanzas, "not-acceptable"
NOT_ALLOWED = namespaces.stanzas, "not-allowed"
NOT_AUTHORIZED = namespaces.stanzas, "not-authorized"
POLICY_VIOLATION = namespaces.stanzas, "policy-violation"
RECIPIENT_UNAVAILABLE = namespaces.stanzas, "recipient-unavailable"
REDIRECT = namespaces.stanzas, "redirect"
xso_class
new_address

The text content of the <redirect/> element represtenting the URI at which the entity can currently be found.

May be None if there is no such URI.

REGISTRATION_REQUIRED = namespaces.stanzas, "registration-required"
REMOTE_SERVER_NOT_FOUND = namespaces.stanzas, "remote-server-not-found"
REMOTE_SERVER_TIMEOUT = namespaces.stanzas, "remote-server-timeout"
RESOURCE_CONSTRAINT = namespaces.stanzas, "resource-constraint"
SERVICE_UNAVAILABLE = namespaces.stanzas, "service-unavailable"
SUBSCRIPTION_REQUIRED = namespaces.stanzas, "subscription-required"
UNDEFINED_CONDITION = namespaces.stanzas, "undefined-condition"
UNEXPECTED_REQUEST = namespaces.stanzas, "unexpected-request"
class aioxmpp.XMPPAuthError(condition, text=None, application_defined_condition=None)[source]
class aioxmpp.XMPPModifyError(condition, text=None, application_defined_condition=None)[source]
class aioxmpp.XMPPCancelError(condition, text=None, application_defined_condition=None)[source]
class aioxmpp.XMPPWaitError(condition, text=None, application_defined_condition=None)[source]
class aioxmpp.XMPPContinueError(condition, text=None, application_defined_condition=None)[source]
class aioxmpp.errors.ErroneousStanza(partial_obj)[source]

This exception is thrown into listeners for IQ responses by aioxmpp.stream.StanzaStream if a response for an IQ was received, but could not be decoded (due to malformed or unsupported payload).

partial_obj

Contains the partially decoded stanza XSO. Do not rely on any members except those representing XML attributes (to, from_, type_).

Stream negotiation exceptions

class aioxmpp.errors.StreamNegotiationFailure[source]
class aioxmpp.errors.SecurityNegotiationFailure(xmpp_error, kind='Security negotiation failure', text=None)[source]
class aioxmpp.errors.SASLUnavailable(xmpp_error, kind='Security negotiation failure', text=None)[source]
class aioxmpp.errors.TLSFailure(xmpp_error, text=None)[source]
class aioxmpp.errors.TLSUnavailable(xmpp_error, text=None)[source]

I18N exceptions

class aioxmpp.errors.UserError(localizable_string, *args, **kwargs)[source]

An exception subclass, which should be used as a mix-in.

It is intended to be used for exceptions which may be user-facing, such as connection errors, value validation issues and the like.

localizable_string must be a i18n.LocalizableString instance. The args and kwargs will be passed to LocalizableString.localize when either str() is called on the UserError or localize() is called.

The str() is created using the default LocalizingFormatter and a gettext.NullTranslations instance. The point in time at which the default localizing formatter is created is unspecified.

localize(formatter, translator)[source]

Return a localized version of the localizable_string passed to the constructor. It is formatted using the formatter with the args and kwargs passed to the constructor of UserError.

class aioxmpp.errors.UserValueError(localizable_string, *args, **kwargs)[source]

This is a ValueError with UserError mixed in.

Other exceptions

class aioxmpp.errors.MultiOSError(message, exceptions)[source]

Describe an error situation which has been caused by the sequential occurrence of multiple other exceptions.

The message shall be descriptive and will be prepended to a concatenation of the error messages of the given exceptions.

class aioxmpp.errors.GatherError(message, exceptions)[source]

Describe an error situation which has been caused by the occurrence of multiple other exceptions.

The message shall be descriptive and will be prepended to a concatenation of the error messages of the given exceptions.