erren

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessCode                = 0
	ServiceErrCode             = 10001
	ParamErrCode               = 10002
	AuthorizationFailedErrCode = 10003
	UserAlreadyExistErrCode    = 10004
	UserNotExistErrCode        = 10005
	TypeNotSupportErrCode      = 10006
	VideoNotFoundErrCode       = 10007
)

新增错误后也需要添加到ErrorMap

Variables

View Source
var (
	Success                = NewErrNo(SuccessCode, "Successfully")
	ServiceErr             = NewErrNo(ServiceErrCode, "Service is unable to start successfully")
	ParamErr               = NewErrNo(ParamErrCode, "Wrong Parameter has been given")
	AuthorizationFailedErr = NewErrNo(AuthorizationFailedErrCode, "Authorization failed")
)
View Source
var ErrorMap = map[int32]struct{}{10001: {}, 10002: {}, 10003: {}, 10004: {}, 10005: {}, 10006: {}, 10007: {}}

Functions

This section is empty.

Types

type ErrEn

type ErrEn struct {
	ErrCode int32
	ErrMsg  string
}

func ConvertErr

func ConvertErr(err error) ErrEn

ConvertErr convert error to ErrEn

func NewErrNo

func NewErrNo(code int32, msg string) ErrEn

func (ErrEn) Error

func (e ErrEn) Error() string

func (ErrEn) WithMessage

func (e ErrEn) WithMessage(msg string) ErrEn

Jump to

Keyboard shortcuts

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