error

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success               = 200  // 成功返回
	Unknown               = 730  // 用户过程返回了错误,但不是LittleRpc可以识别的错误
	MethodNoRegister      = 750  // 需要调用的方法未被注册
	InstanceNoRegister    = 770  // 需要调用的实例未被注册
	MessageDecodingFailed = 780  // 载荷消息解码失败
	MessageEncodingFailed = 1060 // 载荷消息编码失败
	ServerError           = 690  // 服务器的其它错误
	ClientError           = 580  // 客户端产生的错误
	CallArgsTypeErr       = 1030 // 过程的调用参数类型错误
	CodecMarshalErr       = 1050 // Codec在序列化数据时出错
	UnsafeOption          = 2060 // 不安全的选项, 通常在服务器需要的东西没有准备好时触发
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code int

func (Code) MarshalJSON added in v0.3.8

func (c Code) MarshalJSON() ([]byte, error)

func (Code) String

func (c Code) String() string

type LErrorDesc

type LErrorDesc interface {
	Code() int
	Message() string
	AppendMore(more interface{})
	Mores() []interface{}
	MarshalMores() ([]byte, error)
	UnmarshalMores([]byte) error
	error
}

func LNewStdError

func LNewStdError(code int, message string, mores ...interface{}) LErrorDesc

func LWarpStdError added in v0.3.8

func LWarpStdError(desc LErrorDesc, mores ...interface{}) LErrorDesc

type LErrors added in v0.3.8

type LErrors interface {
	// LNewErrorDesc 用于生产LittleRpc中的标准错误
	LNewErrorDesc(code int, message string, mores ...interface{}) LErrorDesc
	// LWarpErrorDesc 用于包装LittleRpc中的标准错误
	LWarpErrorDesc(desc LErrorDesc, mores ...interface{}) LErrorDesc
}

type LNewErrorDesc

type LNewErrorDesc func(code int, message string, mores ...interface{}) LErrorDesc

type LStdError

type LStdError struct {
	LCode    Code          `json:"code"`
	LMessage string        `json:"message"`
	LMores   []interface{} `json:"mores"`
}

func (*LStdError) AppendMore

func (L *LStdError) AppendMore(more interface{})

func (*LStdError) Code

func (L *LStdError) Code() int

func (*LStdError) Error

func (L *LStdError) Error() string

func (*LStdError) MarshalMores

func (L *LStdError) MarshalMores() ([]byte, error)

func (*LStdError) Message

func (L *LStdError) Message() string

func (*LStdError) Mores

func (L *LStdError) Mores() []interface{}

func (*LStdError) UnmarshalMores

func (L *LStdError) UnmarshalMores(bytes []byte) error

type LWarpErrorDesc added in v0.3.8

type LWarpErrorDesc func(desc LErrorDesc, mores ...interface{}) LErrorDesc

Jump to

Keyboard shortcuts

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