xerrs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCode

func GetCode(err error, def ...int) int

func GetData

func GetData(err error) xtypes.XMap

Types

type Option

type Option func(*XErr)

func WithCode

func WithCode(code int) Option

func WithData

func WithData(data xtypes.XMap) Option

type XErr

type XErr struct {
	Code int
	Data xtypes.XMap
	// contains filtered or unexported fields
}

func (*XErr) As

func (a *XErr) As(target interface{}) bool

func (*XErr) Error

func (a *XErr) Error() string

GetCode 获取错误码

func (*XErr) GetCode

func (a *XErr) GetCode() int

GetCode 获取错误码

func (*XErr) GetData

func (a *XErr) GetData() xtypes.XMap

GetCode 获取错误码

func (*XErr) GetError

func (a *XErr) GetError() error

GetError 获取错误信息

func (*XErr) Is

func (a *XErr) Is(e error) bool

func (*XErr) String

func (a *XErr) String() string

GetError 获取错误信息

type Xerror

type Xerror interface {
	error
	GetCode() int
	GetData() xtypes.XMap
}

func New

func New(err error, opts ...Option) Xerror

func NewCode

func NewCode(code int, err error, opts ...Option) Xerror

func Newf

func Newf(f string, args ...interface{}) Xerror

Newf 创建错误对象

Jump to

Keyboard shortcuts

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