errcode

package
v1.0.0-beta.22 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrModNoInvalid = errors.New("mod no should in range 100-999")
	ErrSubNoInvalid = errors.New("sub no should in range 0-999")
	ErrBizNoInvalid = errors.New("biz no should in range 0-999")
)
View Source
var (
	// OK success, nil.
	OK error

	// 100001000-100001999 system reserve error
	ModSystem = Build(100, 1)

	// 100002000-100002999 config error
	ModConfig = Build(100, 2)

	// 100003000-100003999 rpc error
	ModRPC = Build(100, 3)

	// 100004000-100004999 schedule task error
	ModSchedule = Build(100, 4)

	// 100100000-100199999 db error
	ModDB        = Build(100, 100)
	ModMongoDB   = Build(100, 101)
	ModMysql     = Build(100, 102)
	ModPostresql = Build(100, 103)
	ModOracle    = Build(100, 104)
	ModRedis     = Build(100, 105)

	// 100200000-100299999 message queue error
	ModMQ       = Build(100, 200)
	ModKafka    = Build(100, 201)
	ModRocketMQ = Build(100, 202)
	ModRabbitMQ = Build(100, 203)

	// 200001000-200001999 user action error
	ErrUser = Build(200, 1)
)
View Source
var (
	ErrGRPCServerPanic     = ModRPC.Build(1, "grpc server internal error")
	ErrrModDBReadTimeout   = ModDB.Build(1, "db read timeout")
	ErrrModDBWriteTimeout  = ModDB.Build(2, "db write timeout")
	ErrrModDBDeleteTimeout = ModDB.Build(3, "db delete timeout")
)

Functions

func ParseStatus

func ParseStatus(err error) *status.Status

func RegisteredErrors

func RegisteredErrors() []err

Types

type ErrorCodeBuilder

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

func (*ErrorCodeBuilder) Build

func (builder *ErrorCodeBuilder) Build(inputs ...interface{}) error

func (*ErrorCodeBuilder) Code

func (builder *ErrorCodeBuilder) Code() int32

func (*ErrorCodeBuilder) Message

func (builder *ErrorCodeBuilder) Message() string

type ModuleErrorBuilder

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

func Build

func Build(modNo, subNo uint) *ModuleErrorBuilder

func (*ModuleErrorBuilder) Build

func (builder *ModuleErrorBuilder) Build(bizNo uint, msg string) *ErrorCodeBuilder

Jump to

Keyboard shortcuts

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