Errors

Technical reference of Errores.


Symbols

SymbolClassDescription
ErrUnauthorizedvarErrUnauthorized it exposes a shared value of the package.
ErrForbiddenvarErrForbidden it exposes a shared value of the package.
GoxErrorStagetypeGoxErrorStage defines a public type of API.
GoxErrorResolveconstGoxErrorResolve defines a constant value of the API.
GoxErrorCompileconstGoxErrorCompile defines a constant value of the API.
GoxErrorBuildconstGoxErrorBuild defines a constant value of the API.
GoxErrorLoadconstGoxErrorLoad defines a constant value of the API.
GoxErrorDispatchconstGoxErrorDispatch defines a constant value of the API.
GoxErrorPanicconstGoxErrorPanic defines a constant value of the API.
GoxErrorWriterconstGoxErrorWriter defines a constant value of the API.
ErrortypeReturns the textual representation of the error.
ClusterErrortypeClusterError defines a public type of API.
ClusterError.ErrorfuncReturns the textual representation of the error.
ClusterError.UnwrapfuncReturns the underlying error.
ClustervarCluster it exposes a shared value of the package.
ClusterContext.WhenfuncSearch a previous handler.
DispatchClusterErrorfuncOffice DispatchClusterError.
GoxSocketErrorCodetypeGoxSocketErrorCode defines a public type of API.
GoxSocketHandshakeFailedconstGoxSocketHandshakeFailed defines a constant value of the API.
GoxSocketConnectionFailedconstGoxSocketConnectionFailed defines a constant value of the API.
GoxSocketTransportErrorconstGoxSocketTransportError defines a constant value of the API.
GoxSocketHandlerFailedconstGoxSocketHandlerFailed defines a constant value of the API.
GoxSocketInvalidStateconstGoxSocketInvalidState defines a constant value of the API.
GoxSocketConnectionClosedconstGoxSocketConnectionClosed defines a constant value of the API.
GoxSocketProtocolErrorconstGoxSocketProtocolError defines a constant value of the API.
GoxSocketEncodeFailedconstGoxSocketEncodeFailed defines a constant value of the API.
GoxSocketBindFailedconstGoxSocketBindFailed defines a constant value of the API.
GoxSocketEventNotFoundconstGoxSocketEventNotFound defines a constant value of the API.
GoxSocketArgumentCountMismatchconstGoxSocketArgumentCountMismatch defines a constant value of the API.
GoxSocketArgumentTypeMismatchconstGoxSocketArgumentTypeMismatch defines a constant value of the API.
GoxSocketSessionSaveFailedconstGoxSocketSessionSaveFailed defines a constant value of the API.
GoxSocketSessionTouchFailedconstGoxSocketSessionTouchFailed defines a constant value of the API.
GoxSocketSessionExpiredconstGoxSocketSessionExpired defines a constant value of the API.
GoxSocketErrorPhasetypeGoxSocketErrorPhase defines a public type of API.
GoxSocketPhaseHandshakeconstGoxSocketPhaseHandshake defines a constant value of the API.
GoxSocketPhaseConnectionconstGoxSocketPhaseConnection defines a constant value of the API.
GoxSocketPhaseTransportconstGoxSocketPhaseTransport defines a constant value of the API.
GoxSocketPhaseHandlerconstGoxSocketPhaseHandler defines a constant value of the API.
GoxSocketPhaseProtocolconstGoxSocketPhaseProtocol defines a constant value of the API.
GoxSocketPhaseSessionconstGoxSocketPhaseSession defines a constant value of the API.
GoxSocketErrortypeGoxSocketError defines a public type of API.
GoxSocketError.ErrorfuncReturns the textual representation of the error.
GoxSocketError.UnwrapfuncReturns the underlying error.
NewGoxSocketErrorfuncBuild NewGoxSocketError.
ChannelErrorCodetypeChannelErrorCode defines a public type of API.
ChannelInvalidStateconstChannelInvalidState defines a constant value of the API.
ChannelProtocolErrorconstChannelProtocolError defines a constant value of the API.
ChannelHandlerFailedconstChannelHandlerFailed defines a constant value of the API.
ChannelEncodeFailedconstChannelEncodeFailed defines a constant value of the API.
ChannelTransportErrorconstChannelTransportError defines a constant value of the API.
ChannelErrortypeChannelError defines a public type of API.
ChannelError.ErrorfuncReturns the textual representation of the error.
ChannelError.UnwrapfuncReturns the underlying error.
ChannelDisconnectReasontypeChannelDisconnectReason defines a public type of API.
ChannelDisconnectLeftconstChannelDisconnectLeft defines a constant value of the API.
ChannelDisconnectRemovedconstChannelDisconnectRemoved defines a constant value of the API.
ChannelDisconnectRejectedconstChannelDisconnectRejected defines a constant value of the API.
ChannelDisconnectSocketDisconnectedconstChannelDisconnectSocketDisconnected defines a constant value of the API.
ChannelDisconnectClosedconstChannelDisconnectClosed defines a constant value of the API.
ChannelDisconnectServerStoppedconstChannelDisconnectServerStopped defines a constant value of the API.

ErrUnauthorized

Declaration:

gox
ErrUnauthorized = errors.New("unauthorized")

ErrUnauthorized it exposes a shared value of the package.


ErrForbidden

Declaration:

gox
ErrForbidden    = errors.New("forbidden")

ErrForbidden it exposes a shared value of the package.


GoxErrorStage

Declaration:

gox
type GoxErrorStage string

GoxErrorStage defines a public type of API.


GoxErrorResolve

Declaration:

gox
GoxErrorResolve  GoxErrorStage = "resolve"

GoxErrorResolve defines a constant value of the API.


GoxErrorCompile

Declaration:

gox
GoxErrorCompile  GoxErrorStage = "compile"

GoxErrorCompile defines a constant value of the API.


GoxErrorBuild

Declaration:

gox
GoxErrorBuild    GoxErrorStage = "build"

GoxErrorBuild defines a constant value of the API.


GoxErrorLoad

Declaration:

gox
GoxErrorLoad     GoxErrorStage = "load"

GoxErrorLoad defines a constant value of the API.


GoxErrorDispatch

Declaration:

gox
GoxErrorDispatch GoxErrorStage = "dispatch"

GoxErrorDispatch defines a constant value of the API.


GoxErrorPanic

Declaration:

gox
GoxErrorPanic    GoxErrorStage = "panic"

GoxErrorPanic defines a constant value of the API.


GoxErrorWriter

Declaration:

gox
GoxErrorWriter   GoxErrorStage = "writer"

GoxErrorWriter defines a constant value of the API.


Error

Declaration:

gox
type Error interface {
	error

	GetStage() GoxErrorStage
	GetRoute() string
	GetMethod() string
	GetIsAction() bool

	GetFile() string
	GetLine() int
	GetColumn() int
	GetGeneratedFile() string
	GetPluginPath() string

	GetKind() string
	GetMessage() string
	GetHint() string
	GetExpected() string
	GetFound() string

	GetCause() error
	GetStack() string
	GetOriginalError() Error

	GetStatusCode() int
	GetStatusMessage() string
	GetDetails() map[string]string
}

Returns the textual representation of the error.


ClusterError

Declaration:

gox
type ClusterError struct {
	Adapter    string
	Operation  string
	Message    string
	InstanceID string
	Cause      error
}

ClusterError defines a public type of API.

Fields

FieldTypeDescription
AdapterstringName of the adapter.
OperationstringOperation that made the mistake.
MessagestringA descriptive message.
InstanceIDstringAssociated identifier.
Causeerrorunderlying error.

ClusterError.Error

Declaration:

gox
func (err ClusterError) Error() string

Returns the textual representation of the error.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := clusterError.Error()

ClusterError.Unwrap

Declaration:

gox
func (err ClusterError) Unwrap() error

Returns the underlying error.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

Unwrap returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.

Usage syntax

gox
err := clusterError.Unwrap()

Cluster

Declaration:

gox
var Cluster = ClusterContext{events: newServerEventState(), state: newClusterInfoState()}

Cluster it exposes a shared value of the package.


ClusterContext.When

Declaration:

gox
func (cluster *ClusterContext) When(event string, handler any)

Search a previous handler.

Parameters

ParameterTypeDescription
eventstringName of the event.
handleranyType value any required by the operation.

Usage syntax

gox
clusterContext.When("event", nil)

DispatchClusterError

Declaration:

gox
func DispatchClusterError(err ClusterError)

Office DispatchClusterError.

Parameters

ParameterTypeDescription
errClusterErrorType value ClusterError required by the operation.

GoxSocketErrorCode

Declaration:

gox
type GoxSocketErrorCode string

GoxSocketErrorCode defines a public type of API.


GoxSocketHandshakeFailed

Declaration:

gox
GoxSocketHandshakeFailed       GoxSocketErrorCode = "HANDSHAKE_FAILED"

GoxSocketHandshakeFailed defines a constant value of the API.


GoxSocketConnectionFailed

Declaration:

gox
GoxSocketConnectionFailed      GoxSocketErrorCode = "CONNECTION_FAILED"

GoxSocketConnectionFailed defines a constant value of the API.


GoxSocketTransportError

Declaration:

gox
GoxSocketTransportError        GoxSocketErrorCode = "TRANSPORT_ERROR"

GoxSocketTransportError defines a constant value of the API.


GoxSocketHandlerFailed

Declaration:

gox
GoxSocketHandlerFailed         GoxSocketErrorCode = "HANDLER_FAILED"

GoxSocketHandlerFailed defines a constant value of the API.


GoxSocketInvalidState

Declaration:

gox
GoxSocketInvalidState          GoxSocketErrorCode = "INVALID_STATE"

GoxSocketInvalidState defines a constant value of the API.


GoxSocketConnectionClosed

Declaration:

gox
GoxSocketConnectionClosed      GoxSocketErrorCode = "CONNECTION_CLOSED"

GoxSocketConnectionClosed defines a constant value of the API.


GoxSocketProtocolError

Declaration:

gox
GoxSocketProtocolError         GoxSocketErrorCode = "PROTOCOL_ERROR"

GoxSocketProtocolError defines a constant value of the API.


GoxSocketEncodeFailed

Declaration:

gox
GoxSocketEncodeFailed          GoxSocketErrorCode = "ENCODE_FAILED"

GoxSocketEncodeFailed defines a constant value of the API.


GoxSocketBindFailed

Declaration:

gox
GoxSocketBindFailed            GoxSocketErrorCode = "BIND_FAILED"

GoxSocketBindFailed defines a constant value of the API.


GoxSocketEventNotFound

Declaration:

gox
GoxSocketEventNotFound         GoxSocketErrorCode = "EVENT_NOT_FOUND"

GoxSocketEventNotFound defines a constant value of the API.


GoxSocketArgumentCountMismatch

Declaration:

gox
GoxSocketArgumentCountMismatch GoxSocketErrorCode = "ARGUMENT_COUNT_MISMATCH"

GoxSocketArgumentCountMismatch defines a constant value of the API.


GoxSocketArgumentTypeMismatch

Declaration:

gox
GoxSocketArgumentTypeMismatch  GoxSocketErrorCode = "ARGUMENT_TYPE_MISMATCH"

GoxSocketArgumentTypeMismatch defines a constant value of the API.


GoxSocketSessionSaveFailed

Declaration:

gox
GoxSocketSessionSaveFailed     GoxSocketErrorCode = "SESSION_SAVE_FAILED"

GoxSocketSessionSaveFailed defines a constant value of the API.


GoxSocketSessionTouchFailed

Declaration:

gox
GoxSocketSessionTouchFailed    GoxSocketErrorCode = "SESSION_TOUCH_FAILED"

GoxSocketSessionTouchFailed defines a constant value of the API.


GoxSocketSessionExpired

Declaration:

gox
GoxSocketSessionExpired        GoxSocketErrorCode = "SESSION_EXPIRED"

GoxSocketSessionExpired defines a constant value of the API.


GoxSocketErrorPhase

Declaration:

gox
type GoxSocketErrorPhase string

GoxSocketErrorPhase defines a public type of API.


GoxSocketPhaseHandshake

Declaration:

gox
GoxSocketPhaseHandshake  GoxSocketErrorPhase = "handshake"

GoxSocketPhaseHandshake defines a constant value of the API.


GoxSocketPhaseConnection

Declaration:

gox
GoxSocketPhaseConnection GoxSocketErrorPhase = "connection"

GoxSocketPhaseConnection defines a constant value of the API.


GoxSocketPhaseTransport

Declaration:

gox
GoxSocketPhaseTransport  GoxSocketErrorPhase = "transport"

GoxSocketPhaseTransport defines a constant value of the API.


GoxSocketPhaseHandler

Declaration:

gox
GoxSocketPhaseHandler    GoxSocketErrorPhase = "handler"

GoxSocketPhaseHandler defines a constant value of the API.


GoxSocketPhaseProtocol

Declaration:

gox
GoxSocketPhaseProtocol   GoxSocketErrorPhase = "protocol"

GoxSocketPhaseProtocol defines a constant value of the API.


GoxSocketPhaseSession

Declaration:

gox
GoxSocketPhaseSession    GoxSocketErrorPhase = "session"

GoxSocketPhaseSession defines a constant value of the API.


GoxSocketError

Declaration:

gox
type GoxSocketError struct {
	Code      GoxSocketErrorCode
	Message   string
	Phase     GoxSocketErrorPhase
	Event     string
	Retryable bool
	Cause     error
	EventID   uint64
	Argument  int
	Received  string
	Expected  string
	Remote    bool
}

GoxSocketError defines a public type of API.

Fields

FieldTypeDescription
CodeGoxSocketErrorCodeCode that classifies the state.
MessagestringA descriptive message.
PhaseGoxSocketErrorPhasePhase that made the mistake.
EventstringName of the event.
RetryableboolIt indicates whether the operation can be retried.
Causeerrorunderlying error.
EventIDuint64Associated identifier.
ArgumentintInvalid argument index.
ReceivedstringType or value received.
ExpectedstringExpected type or value.
RemoteboolIt indicates whether the error originated in another instance.

GoxSocketError.Error

Declaration:

gox
func (err GoxSocketError) Error() string

Returns the textual representation of the error.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := goxSocketError.Error()

GoxSocketError.Unwrap

Declaration:

gox
func (err GoxSocketError) Unwrap() error

Returns the underlying error.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

Unwrap returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.

Usage syntax

gox
err := goxSocketError.Unwrap()

NewGoxSocketError

Declaration:

gox
func NewGoxSocketError(code GoxSocketErrorCode, message string, phase GoxSocketErrorPhase, event string, retryable bool, cause error) GoxSocketError

Build NewGoxSocketError.

Parameters

ParameterTypeDescription
codeGoxSocketErrorCodeCode of closure.
messagestringType value string required by the operation.
phaseGoxSocketErrorPhaseType value GoxSocketErrorPhase required by the operation.
eventstringName of the event.
retryableboolType value bool required by the operation.
causeerrorType value error required by the operation.

Returns

ReturnTypeDescription
valueGoxSocketErrorType value GoxSocketError produced by the operation.

Usage syntax

gox
value := gox.NewGoxSocketError(200, value, value, "event", value, value)

ChannelErrorCode

Declaration:

gox
type ChannelErrorCode string

ChannelErrorCode defines a public type of API.


ChannelInvalidState

Declaration:

gox
ChannelInvalidState   ChannelErrorCode = "INVALID_STATE"

ChannelInvalidState defines a constant value of the API.


ChannelProtocolError

Declaration:

gox
ChannelProtocolError  ChannelErrorCode = "PROTOCOL_ERROR"

ChannelProtocolError defines a constant value of the API.


ChannelHandlerFailed

Declaration:

gox
ChannelHandlerFailed  ChannelErrorCode = "HANDLER_FAILED"

ChannelHandlerFailed defines a constant value of the API.


ChannelEncodeFailed

Declaration:

gox
ChannelEncodeFailed   ChannelErrorCode = "ENCODE_FAILED"

ChannelEncodeFailed defines a constant value of the API.


ChannelTransportError

Declaration:

gox
ChannelTransportError ChannelErrorCode = "TRANSPORT_ERROR"

ChannelTransportError defines a constant value of the API.


ChannelError

Declaration:

gox
type ChannelError struct {
	Code      ChannelErrorCode
	ChannelID string
	Event     string
	Message   string
	Retryable bool
	Cause     error
}

ChannelError defines a public type of API.

Fields

FieldTypeDescription
CodeChannelErrorCodeCode that classifies the state.
ChannelIDstringAssociated identifier.
EventstringName of the event.
MessagestringA descriptive message.
RetryableboolIt indicates whether the operation can be retried.
Causeerrorunderlying error.

ChannelError.Error

Declaration:

gox
func (err ChannelError) Error() string

Returns the textual representation of the error.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := channelError.Error()

ChannelError.Unwrap

Declaration:

gox
func (err ChannelError) Unwrap() error

Returns the underlying error.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

Unwrap returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.

Usage syntax

gox
err := channelError.Unwrap()

ChannelDisconnectReason

Declaration:

gox
type ChannelDisconnectReason string

ChannelDisconnectReason defines a public type of API.


ChannelDisconnectLeft

Declaration:

gox
ChannelDisconnectLeft               ChannelDisconnectReason = "left"

ChannelDisconnectLeft defines a constant value of the API.


ChannelDisconnectRemoved

Declaration:

gox
ChannelDisconnectRemoved            ChannelDisconnectReason = "removed"

ChannelDisconnectRemoved defines a constant value of the API.


ChannelDisconnectRejected

Declaration:

gox
ChannelDisconnectRejected           ChannelDisconnectReason = "rejected"

ChannelDisconnectRejected defines a constant value of the API.


ChannelDisconnectSocketDisconnected

Declaration:

gox
ChannelDisconnectSocketDisconnected ChannelDisconnectReason = "socket-disconnected"

ChannelDisconnectSocketDisconnected defines a constant value of the API.


ChannelDisconnectClosed

Declaration:

gox
ChannelDisconnectClosed             ChannelDisconnectReason = "closed"

ChannelDisconnectClosed defines a constant value of the API.


ChannelDisconnectServerStopped

Declaration:

gox
ChannelDisconnectServerStopped      ChannelDisconnectReason = "server-stopped"

ChannelDisconnectServerStopped defines a constant value of the API.

Next step

Continue with WebSocket API.

WebSocket