errors

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 5 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNil                   = New("nil")
	ErrInvalidGID            = New("invalid gate id")
	ErrInvalidNID            = New("invalid node id")
	ErrInvalidMessage        = New("invalid message")
	ErrInvalidReader         = New("invalid reader")
	ErrNotFoundSession       = New("not found session")
	ErrInvalidSessionKind    = New("invalid session kind")
	ErrReceiveTargetEmpty    = New("the receive target is empty")
	ErrInvalidArgument       = New("invalid argument")
	ErrNotFoundRoute         = New("not found route")
	ErrNotFoundEvent         = New("not found event")
	ErrNotFoundEndpoint      = New("not found endpoint")
	ErrNotFoundUserLocation  = New("not found user's location")
	ErrClientShut            = New("client is shut")
	ErrConnectionOpened      = New("connection is opened")
	ErrConnectionHanged      = New("connection is hanged")
	ErrConnectionClosed      = New("connection is closed")
	ErrConnectionNotOpened   = New("connection is not opened")
	ErrConnectionNotHanged   = New("connection is not hanged")
	ErrTooManyConnection     = New("too many connection")
	ErrSeqOverflow           = New("seq overflow")
	ErrRouteOverflow         = New("route overflow")
	ErrMessageTooLarge       = New("message too large")
	ErrInvalidDecoder        = New("invalid decoder")
	ErrInvalidScanner        = New("invalid scanner")
	ErrNoOperationPermission = New("no operation permission")
	ErrInvalidConfigContent  = New("invalid config content")
	ErrNotFoundConfigSource  = New("not found config source")
	ErrInvalidFormat         = New("invalid format")
	ErrIllegalRequest        = New("illegal request")
	ErrIllegalOperation      = New("illegal operation")
	ErrInvalidPointer        = New("invalid pointer")
	ErrNotFoundLocator       = New("not found locator")
	ErrUnexpectedEOF         = New("unexpected EOF")
	ErrMissTransporter       = New("miss transporter")
	ErrMissDiscovery         = New("miss discovery")
	ErrNotFoundDirectAddress = New("not found direct address")
	ErrUnknownError          = New("unknown error")
	ErrClientClosed          = New("client is closed")
	ErrActorExists           = New("actor exists")
	ErrMissDispatchStrategy  = New("missing dispatch strategy")
	ErrUnregisterRoute       = New("unregistered route")
	ErrNotBindActor          = New("not bind actor")
	ErrNotFoundActor         = New("not found actor")
)

Functions

func As

func As(err error, target interface{}) bool

As Wrapping for errors.As standard library

func Cause

func Cause(err error) error

Cause 返回根因错误

func Code

func Code(err error) *codes.Code

Code 返回错误码

func Is

func Is(err, target error) bool

Is Wrapping for errors.Is standard library

func New

func New(text string) error

New Wrapping for errors.New standard library

func Next

func Next(err error) error

Next 返回下一个错误

func Replace

func Replace(err error, text string, condition ...codes.Code) error

Replace 替换文本

func Stack

func Stack(err error) *stack.Stack

Stack 返回堆栈

func Unwrap

func Unwrap(err error) error

Unwrap Wrapping for errors.Unwrap standard library

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(args ...interface{}) *Error

NewError 新建一个错误 可传入一下参数: text : 文本字符串 code : 错误码 error: 原生错误

func NewErrorWithStack

func NewErrorWithStack(args ...interface{}) *Error

NewErrorWithStack 新建一个带堆栈的错误 可传入一下参数: text : 文本字符串 code : 错误码 error: 原生错误

func (*Error) Cause

func (e *Error) Cause() error

Cause 返回根因错误

func (*Error) Code

func (e *Error) Code() *codes.Code

Code 返回错误码

func (*Error) Error

func (e *Error) Error() (text string)

func (*Error) Format

func (e *Error) Format(s fmt.State, verb rune)

Format 格式化输出 %s : 打印本级错误信息 %v : 打印所有错误信息 %+v: 打印所有错误信息和堆栈信息

func (*Error) Next

func (e *Error) Next() error

Next 返回下一个错误

func (*Error) Replace

func (e *Error) Replace(text string, condition ...*codes.Code) error

Replace 替换文本

func (*Error) Stack

func (e *Error) Stack() *stack.Stack

Stack 返回堆栈

func (*Error) String

func (e *Error) String() string

String 格式化错误信息

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap 解包错误

Jump to

Keyboard shortcuts

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