errx

package
v0.0.0-...-9a83fbb Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatchPanic

func CatchPanic(message string)

func CheckError

func CheckError(err error)

func NotEmpty

func NotEmpty(source string, parameter string)

func NotNil

func NotNil(source interface{}, parameter string)

func Panic

func Panic(errStr string)

func PrintStack

func PrintStack() string

Types

type ErrCode

type ErrCode = int

纯数字表示,不同部位代表不同的服务,不同的模块

错误代码说明:100101

- 10: 应用服务。

- 01: 某个服务下的某个模块。

- 01: 模块下的错误码序号,每个模块可以注册 100 个错误。

每个模块可以注册 100 个错误。

var (

	// 未知错误
	ErrCodeUnkown ErrCode = 100000

	// 未知原因参数不合法
	ErrUnkownParameterUnvalid ErrCode = 100001
)

type MultiError

type MultiError struct {
	// contains filtered or unexported fields
}

func Errors

func Errors(message string, errs ...error) MultiError

func (*MultiError) Add

func (e *MultiError) Add(message string, err error)

func (*MultiError) AddError

func (e *MultiError) AddError(err error)

func (MultiError) Error

func (err MultiError) Error() string

func (*MultiError) HasError

func (e *MultiError) HasError() bool

type ValidationError

type ValidationError struct {
	ValidationErrors []*ValidationResult
}

func (*ValidationError) Error

func (v *ValidationError) Error() string

type ValidationResult

type ValidationResult struct {
	FieldName string `json:"fieldName"`
	Message   string `json:"message"`
}

Jump to

Keyboard shortcuts

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