Documentation
¶
Index ¶
- Variables
- func As(err error, target any) bool
- func Cause(err error) error
- func Code(err error) *codes.Code
- func Is(err, target error) bool
- func IsCode(err error, code *codes.Code) bool
- func IsConfigError(err error) bool
- func IsEncodingError(err error) bool
- func IsErr(err, target error) bool
- func IsNetworkError(err error) bool
- func IsRouteError(err error) bool
- func IsSecurityError(err error) bool
- func IsServiceError(err error) bool
- func IsSessionError(err error) bool
- func New(text string) error
- func Next(err error) error
- func Replace(err error, text string, condition ...codes.Code) error
- func Stack(err error) *stack.Stack
- func Unwrap(err error) error
- func UnwrapError(err error) error
- type Error
- func (e *Error) Cause() error
- func (e *Error) Code() *codes.Code
- func (e *Error) Error() (text string)
- func (e *Error) Format(s fmt.State, verb rune)
- func (e *Error) Next() error
- func (e *Error) Replace(text string, condition ...*codes.Code) error
- func (e *Error) Stack() *stack.Stack
- func (e *Error) String() string
- func (e *Error) Unwrap() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNil = NewWithCode(codes.Unknown, "nil") ErrInvalidArgument = NewWithCode(codes.InvalidArgument, "invalid argument") ErrInvalidPointer = NewWithCode(codes.InvalidPointer, "invalid pointer") ErrInvalidFormat = NewWithCode(codes.InvalidFormat, "invalid format") ErrIllegalRequest = NewWithCode(codes.IllegalRequest, "illegal request") ErrIllegalOperation = NewWithCode(codes.IllegalInvoke, "illegal operation") ErrDeadlineExceeded = NewWithCode(codes.DeadlineExceeded, "deadline exceeded") ErrUnknownError = NewWithCode(codes.Unknown, "unknown error") ErrNoOperationPermission = NewWithCode(codes.PermissionDenied, "no operation permission") )
通用错误
View Source
var ( ErrInvalidReader = NewWithCode(codes.InvalidReader, "invalid reader") ErrConnectionOpened = NewWithCode(codes.ConnectionOpened, "connection is opened") ErrConnectionHanged = NewWithCode(codes.ConnectionHanged, "connection is hanged") ErrConnectionClosed = NewWithCode(codes.ConnectionClosed, "connection is closed") ErrConnectionNotOpened = NewWithCode(codes.ConnectionNotOpened, "connection is not opened") ErrConnectionNotHanged = NewWithCode(codes.ConnectionNotHanged, "connection is not hanged") ErrTooManyConnection = NewWithCode(codes.TooManyConnections, "too many connection") ErrUnexpectedEOF = NewWithCode(codes.UnexpectedEOF, "unexpected EOF") )
网络/连接错误
View Source
var ( ErrInvalidGID = NewWithCode(codes.InvalidGateID, "invalid gate id") ErrInvalidNID = NewWithCode(codes.InvalidNodeID, "invalid node id") ErrNotFoundSession = NewWithCode(codes.SessionNotFound, "not found session") ErrInvalidSessionKind = NewWithCode(codes.InvalidSessionKind, "invalid session kind") ErrNotFoundUserLocation = NewWithCode(codes.UserLocationNotFound, "not found user's location") ErrActorExists = NewWithCode(codes.ActorExists, "actor exists") ErrNotFoundActor = NewWithCode(codes.ActorNotFound, "not found actor") ErrNotBindActor = NewWithCode(codes.ActorNotBound, "not bind actor") )
会话/用户错误
View Source
var ( ErrInvalidMessage = NewWithCode(codes.InvalidMessage, "invalid message") ErrReceiveTargetEmpty = NewWithCode(codes.TargetEmpty, "the receive target is empty") ErrNotFoundRoute = NewWithCode(codes.RouteNotFound, "not found route") ErrNotFoundEvent = NewWithCode(codes.EventNotFound, "not found event") ErrSeqOverflow = NewWithCode(codes.SeqOverflow, "seq overflow") ErrRouteOverflow = NewWithCode(codes.RouteOverflow, "route overflow") ErrMessageTooLarge = NewWithCode(codes.MessageTooLarge, "message too large") ErrInvalidDecoder = NewWithCode(codes.InvalidDecoder, "invalid decoder") ErrInvalidScanner = NewWithCode(codes.InvalidScanner, "invalid scanner") ErrUnregisterRoute = NewWithCode(codes.RouteUnregistered, "unregistered route") )
路由/消息错误
View Source
var ( ErrInvalidConfigContent = NewWithCode(codes.InvalidConfig, "invalid config content") ErrNotFoundConfigSource = NewWithCode(codes.ConfigSourceNotFound, "not found config source") ErrMissingTransporter = NewWithCode(codes.MissingTransporter, "missing transporter") ErrMissingDiscovery = NewWithCode(codes.MissingDiscovery, "missing discovery") ErrNotFoundLocator = NewWithCode(codes.MissingLocator, "not found locator") ErrMissingResolver = NewWithCode(codes.MissingResolver, "missing resolver") ErrMissingDispatchStrategy = NewWithCode(codes.MissingDispatchStrategy, "missing dispatch strategy") ErrMissingCacheInstance = NewWithCode(codes.MissingCacheInstance, "missing cache instance") ErrMissingEventbusInstance = NewWithCode(codes.MissingEventbusInstance, "missing eventbus instance") ErrClientShut = NewWithCode(codes.ClientShut, "client is shut") ErrClientClosed = NewWithCode(codes.ClientShut, "client is closed") ErrServerClosed = NewWithCode(codes.ServerClosed, "server is closed") ErrSyncerClosed = NewWithCode(codes.SyncerClosed, "syncer is closed") )
配置/初始化错误
View Source
var ( ErrNotFoundEndpoint = NewWithCode(codes.EndpointNotFound, "not found endpoint") ErrNotFoundServiceAddress = NewWithCode(codes.ServiceAddressNotFound, "not found service address") ErrServiceRegisterFailed = NewWithCode(codes.ServiceRegisterFailed, "service register failed") ErrServiceDeregisterFailed = NewWithCode(codes.ServiceDeregisterFailed, "service deregister failed") ErrInvalidServiceDesc = NewWithCode(codes.InvalidServiceDesc, "invalid service desc") ErrNotFoundIPAddress = NewWithCode(codes.ServiceAddressNotFound, "not found ip address") )
服务/集群错误
View Source
var ( ErrInvalidPublicKey = NewWithCode(codes.InvalidPublicKey, "invalid public key") ErrInvalidPrivateKey = NewWithCode(codes.InvalidPrivateKey, "invalid private key") ErrInvalidSignature = NewWithCode(codes.InvalidSignature, "invalid signature") ErrInvalidCertFile = NewWithCode(codes.InvalidCertFile, "invalid cert file") ErrInvalidKeyFormat = NewWithCode(codes.InvalidKeyFormat, "invalid key format") ErrBlockSizeTooLarge = NewWithCode(codes.BlockSizeTooLarge, "block size too large for RSA key") )
安全/加密错误
View Source
var ( ErrCodecNotRegistered = NewWithCode(codes.CodecNotRegistered, "codec not registered") ErrSignerNotRegistered = NewWithCode(codes.SignerNotRegistered, "signer not registered") ErrEncryptorNotRegistered = NewWithCode(codes.EncryptorNotRegistered, "encryptor not registered") ErrProtoMarshalError = NewWithCode(codes.ProtoMarshalError, "proto marshal error") ErrProtoUnmarshalError = NewWithCode(codes.ProtoUnmarshalError, "proto unmarshal error") )
编码/序列化错误
Functions ¶
func IsEncodingError ¶ added in v1.0.9
IsEncodingError 判断是否是编码错误
func IsSecurityError ¶ added in v1.0.9
IsSecurityError 判断是否是安全错误
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewErrorWithStack ¶
NewErrorWithStack 新建一个带堆栈的错误 可传入以下参数: text : 文本字符串 code : 错误码 error: 原生错误
func NewWithCode ¶ added in v1.0.9
NewWithCode 新建一个带错误码的错误
func WrapWithCode ¶ added in v1.0.9
WrapWithCode 包装一个错误,添加错误码和上下文信息
Click to show internal directories.
Click to hide internal directories.