codes

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OK               = NewCode(0, "ok")
	Canceled         = NewCode(1, "canceled")
	Unknown          = NewCode(2, "unknown")
	InvalidArgument  = NewCode(3, "invalid argument")
	DeadlineExceeded = NewCode(4, "deadline exceeded")
	NotFound         = NewCode(5, "not found")
	InternalError    = NewCode(6, "internal error")
	Unauthorized     = NewCode(7, "unauthorized")
	IllegalInvoke    = NewCode(8, "illegal invoke")
	IllegalRequest   = NewCode(9, "illegal request")

	NotLocatedUser = NewCode(3, "not located user")
)

Functions

This section is empty.

Types

type Code

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

func Convert

func Convert(err error) *Code

func NewCode

func NewCode(code int, message string) *Code

func (*Code) Code

func (c *Code) Code() int

Code 返回错误码

func (*Code) Err

func (c *Code) Err() error

Err 转错误消息

func (*Code) ErrWith

func (c *Code) ErrWith()

func (*Code) Format

func (c *Code) Format(s fmt.State, verb rune)

Format 格式化输出 %s : 打印错误码和错误消息 %v : 打印错误码、错误消息、错误详情

func (*Code) Message

func (c *Code) Message() string

Message 返回错误码消息

func (*Code) String

func (c *Code) String() string

String 格式化错误码

type Error

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

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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