ep

package
v0.0.0-...-bed3fb8 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOK               = ErrPack{2000, "success"}
	ErrUnknown          = ErrPack{5900, "unknown error"}
	ErrNotLogin         = ErrPack{4001, "user not logged in error"}
	ErrNoPermission     = ErrPack{4002, "no permission error"}
	ErrInputHeader      = ErrPack{4003, "input header error"}
	ErrInputBody        = ErrPack{4004, "input body error"}
	ErrParseToken       = ErrPack{5201, "parse token error"}
	ErrServiceConn      = ErrPack{5301, "service communication error"}
	ErrLogic            = ErrPack{5501, "logical error"}
	ErrCacheConn        = ErrPack{5601, "cache connection error"}
	ErrNoCache          = ErrPack{5602, "no cache error"}
	ErrDBConn           = ErrPack{5701, "database connection error"}
	ErrNoRecord         = ErrPack{5702, "database no record error"}
	ErrDuplicatedRecord = ErrPack{5703, "database duplicated record error"}
	ErrTypeConv         = ErrPack{5901, "type conversion error"}
	ErrGenJWT           = ErrPack{5903, "generate JWT error"}
	ErrParseJWT         = ErrPack{5903, "parse JWT error"}
)

Functions

This section is empty.

Types

type ErrPack

type ErrPack struct {
	Code int32  `json:"code,omitempty" ep:"err.code"`
	Msg  string `json:"msg,omitempty" ep:"err.msg"`
}

func (ErrPack) Error

func (e ErrPack) Error() string

Error implement error type

type Packer

type Packer struct {
	V interface{}
}

func (*Packer) Pack

func (p *Packer) Pack(err error) interface{}

Pack return the given interface with tagged values and ErrPack

func (*Packer) PackWithError

func (p *Packer) PackWithError(err error) interface{}

PackWithError will do the pack and additionally log the error with Error level

func (*Packer) PackWithInfo

func (p *Packer) PackWithInfo(err error) interface{}

PackWithInfo will do the pack and additionally log the error with INFO level

func (*Packer) PackWithWarn

func (p *Packer) PackWithWarn(err error) interface{}

PackWithWarn will do the pack and additionally log the error with WARN level

Jump to

Keyboard shortcuts

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