errorx

package
v0.0.0-...-4675295 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatErrors

func FormatErrors(errs []error) string

func Has

func Has(err error, ident string) bool

func New

func New(ident string, args ...map[string]interface{}) error

New 新建一个错误。 args只保存第一个元素

func Wrap

func Wrap(err error, ident string, args ...map[string]interface{}) error

Wrap 包装一个错误。 args只保存第一个元素

Types

type Error

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

func (*Error) Args

func (err *Error) Args() map[string]interface{}

Args 指定的 args 按照约定格式编写,便于与 ident 分离,更容易的判断错误类型。 可通过 mapx 包获取错误时输入的参数

func (*Error) Error

func (err *Error) Error() (r string)

Error 最终形成字符串:ident?key=value&key2=value2

func (*Error) Has

func (err *Error) Has(ident string) bool

func (*Error) Ident

func (err *Error) Ident() string

Ident 指定的 ident 用于识别错误的类型。

Jump to

Keyboard shortcuts

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