stanzaerror

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 2 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// Reason is the stanza error reason type.
	Reason Reason

	// SentElement is the original XMPP element that originated the stanza error.
	SentElement stravaganza.Element

	// Lang is the error text lang code.
	// If none assigned 'en' would be considered by default.
	Lang string

	// Text is the error descriptive text.
	Text string

	// ApplicationElement defines the application specific condition element.
	ApplicationElement stravaganza.Element
}

Error represents a stanza "error" element.

func E

func E(reason Reason, sentElement stravaganza.Element) *Error

E builds an error value from its arguments.

func (*Error) Element

func (se *Error) Element() stravaganza.Element

Element returns se XMPP generic element.

func (*Error) Error

func (se *Error) Error() string

Error method satisfies error interface.

func (*Error) Stanza added in v0.15.1

func (se *Error) Stanza(validateJIDs bool) (stravaganza.Stanza, error)

Stanza returns se XMPP stanza element.

type Reason

type Reason uint8

Reason is the stanza error reason.

const (
	// BadRequest error is returned when the sender has sent XML that is malformed or that cannot be processed.
	BadRequest Reason = iota

	// Conflict error is returned when access cannot be granted because an existing resource or session exists with
	// the same name or address.
	Conflict

	// FeatureNotImplemented is returned when the feature requested is not implemented by the server and therefore
	// cannot be processed.
	FeatureNotImplemented

	// Forbidden is returned when the requesting entity does not possess the required permissions to perform the action.
	Forbidden

	// Gone is returned when the recipient or server can no longer be contacted at this address.
	Gone

	// InternalServerError is returned when the server could not process the stanza because of a misconfiguration
	// or an otherwise-undefined internal server error.
	InternalServerError

	// ItemNotFound is returned when the addressed JID or item requested cannot be found.
	ItemNotFound

	// JIDMalformed is returned when the sending entity has provided or communicated an XMPP address or aspect thereof
	// that does not adhere to the syntax defined in https://xmpp.org/rfcs/rfc3920.html#addressing.
	JIDMalformed

	// NotAcceptable is returned when the sending entity has provided or communicated an XMPP address or aspect thereof
	// that does not adhere to the syntax defined in https://xmpp.org/rfcs/rfc3920.html#addressing.
	NotAcceptable

	// NotAllowed is returned when the recipient or server does not allow any entity to perform the action.
	NotAllowed

	// NotAuthorized is returned when the sender must provide proper credentials before being allowed to perform
	// the action, or has provided improper credentials.
	NotAuthorized

	// PaymentRequired is returned when the requesting entity is not authorized to access the requested service
	// because payment is required.
	PaymentRequired

	// RecipientUnavailable is returned when the intended recipient is temporarily unavailable.
	RecipientUnavailable

	// Redirect is redirecting requests for this information to another entity, usually temporarily.
	Redirect

	// RegistrationRequired is redirecting requests for this information to another entity, usually temporarily.
	RegistrationRequired

	// RemoteServerNotFound is returned when a remote server or service specified as part or all of the JID
	// of the intended recipient does not exist.
	RemoteServerNotFound

	// RemoteServerTimeout is returned when a remote server or service specified as part or all of the JID of
	// the intended recipient could not be contacted within a reasonable amount of time.
	RemoteServerTimeout

	// ResourceConstraint is returned when the server or recipient lacks the system resources necessary
	// to service the request.
	ResourceConstraint

	// ServiceUnavailable is returned when the server or recipient does not currently provide
	// the requested service.
	ServiceUnavailable

	// SubscriptionRequired is returned when the requesting entity is not authorized to access
	// the requested service because a subscription is required.
	SubscriptionRequired

	// UndefinedCondition is returned when the error condition is not one of those defined by the other conditions in
	// this list.
	UndefinedCondition

	// UnexpectedCondition is returned when the recipient or server understood the request but was not expecting it
	// at this time.
	UnexpectedCondition

	// UnexpectedRequest is returned by the stream when the recipient or server understood the request but was not
	// expecting it at this time.
	UnexpectedRequest
)

func (Reason) Code

func (r Reason) Code() int

Code returns Reason associated code.

func (Reason) String

func (r Reason) String() string

String returns Reason string representation.

func (Reason) Type

func (r Reason) Type() Type

Type returns Reason associated error type.

type Type

type Type uint8

Type is the stanza error type.

const (
	// Auth represents 'auth' error type.
	Auth Type = iota

	// Cancel represents 'cancel' error type.
	Cancel

	// Modify represents 'modify' error type.
	Modify

	// Wait represents 'wait' error type.
	Wait
)

func (Type) String

func (t Type) String() string

String returns Type string representation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL