xerr

package module
v0.0.0-...-b748485 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// News 创建错误
	New = pkgErr.New
	// As 判断自定义错误
	As = pkgErr.As
	// WithStack 给 err 增加堆栈
	WithStack = pkgErr.WithStack
)

Functions

func AsReject

func AsReject(err error) (rejectValue *reject, asReject bool)

func EqualRejectCode

func EqualRejectCode(t *testing.T, err error, code int32)

func EqualRejectMessage

func EqualRejectMessage(t *testing.T, err error, message string)

func Is

func Is(err error, target error) bool

判断 Sentinel Error 错误

func PrintStack

func PrintStack(err error)

func Reject

func Reject(code int32, publicMessage string, shouldRecord bool) error

func Unwrap

func Unwrap(err error) error

获取被包装的底层错误

func WrapPrefix

func WrapPrefix(prefix string, err error) error

包装错误

Types

type IRejecter

type IRejecter interface {
	Error() string
	Resp() Resp
}

type Resp

type Resp struct {
	Error respError `json:"error"`
}

func NewResp

func NewResp(code int32, message string) Resp

Directories

Path Synopsis
docs module

Jump to

Keyboard shortcuts

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