errors

package
v1.7.8 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT, Apache-2.0 Imports: 3 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(code ErrCode, msg string)

不是并发安全的,在初始化的时候做

Types

type ErrCode

type ErrCode int32
const (
	// SysErr ErrCode = -1
	Success            ErrCode = 0
	Canceled           ErrCode = 1
	Unknown            ErrCode = 2
	InvalidArgument    ErrCode = 3
	DeadlineExceeded   ErrCode = 4
	NotFound           ErrCode = 5
	AlreadyExists      ErrCode = 6
	PermissionDenied   ErrCode = 7
	ResourceExhausted  ErrCode = 8
	FailedPrecondition ErrCode = 9
	Aborted            ErrCode = 10
	OutOfRange         ErrCode = 11
	Unimplemented      ErrCode = 12
	Internal           ErrCode = 13
	Unavailable        ErrCode = 14
	DataLoss           ErrCode = 15
	Unauthenticated    ErrCode = 16
)

func (ErrCode) ErrResp added in v1.3.9

func (x ErrCode) ErrResp() *ErrResp

func (ErrCode) Error

func (x ErrCode) Error() string

func (ErrCode) Msg

func (x ErrCode) Msg(msg string) *ErrResp

func (ErrCode) String

func (x ErrCode) String() string

func (ErrCode) Wrap

func (x ErrCode) Wrap(err error) *ErrResp

type ErrResp added in v1.3.9

type ErrResp struct {
	Code ErrCode `json:"code"`
	Msg  string  `json:"msg,omitempty"`
}

func ErrRespFrom added in v1.3.9

func ErrRespFrom(err error) *ErrResp

func NewErrResp added in v1.3.9

func NewErrResp(code ErrCode, msg string) *ErrResp

func (*ErrResp) ErrResp added in v1.6.13

func (x *ErrResp) ErrResp() *ErrResp

func (*ErrResp) Error added in v1.3.9

func (x *ErrResp) Error() string

func (*ErrResp) MarshalJSON added in v1.3.9

func (x *ErrResp) MarshalJSON() ([]byte, error)

type IErrResp added in v1.3.9

type IErrResp interface {
	ErrResp() *ErrResp
}

Jump to

Keyboard shortcuts

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