gkgo2err

package
v0.0.0-...-b8b67ef Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeTypeCommon   = 1
	CodeTypeBusiness = 2
)
View Source
const (
	System = 1
	User   = 2
)

Variables

This section is empty.

Functions

func NewInvokeNode

func NewInvokeNode(param interface{}, errMsg string) *invokeNode

Types

type Code

type Code struct {
	Type     CodeType
	Category uint8
	SubCode  int
	Msg      string `json:"message"`
	Code     int    `json:"retcode"`
}

type CodeCategoryFactory

type CodeCategoryFactory struct {
	Type CodeType
}

func Business

func Business() *CodeCategoryFactory

func Common

func Common() *CodeCategoryFactory

func (*CodeCategoryFactory) New

func (f *CodeCategoryFactory) New(cat uint8) *CodeFactory

type CodeFactory

type CodeFactory struct {
	Type     CodeType
	Category uint8
}

func (*CodeFactory) New

func (f *CodeFactory) New(subCode int, msg string) *Code

type CodeType

type CodeType uint8

type Error

type Error struct {
	InvokeLink *invokeNode
	Location   string
	// contains filtered or unexported fields
}

func New

func New(cm *Code, param interface{}, format string, a ...interface{}) *Error

完全新建一个错误,用于偏底层操作错误

func With

func With(cm *Code, param interface{}, err error) *Error

以当前错误为基础生成一个错误,用于偏底层操作错误

func Wrap

func Wrap(err *Error, param interface{}, cm *Code) *Error

包括一个错误,可以构建调用链,用于偏上层操作错误

func (*Error) CodeMsg

func (p *Error) CodeMsg() *Code

func (*Error) Error

func (p *Error) Error() string

Jump to

Keyboard shortcuts

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