errors

package
v0.0.0-...-f600046 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is

func Is(err, target error) bool

Types

type Error

type Error struct {
	Type    Type   `bson:"type" json:"type"`
	Code    string `bson:"code"  json:"code"`
	Message string `bson:"message" json:"message"`

	Err error `bson:"-" json:"-"` // Native error
}

func Assert

func Assert(expect string, actual string, nativeErr ...error) *Error

func E

func E(code string, args ...any) *Error

func Of

func Of(t Type, code string, message string, nativeErr ...error) *Error

func System

func System(message string, nativeErr ...error) *Error

func Verify

func Verify(message string, nativeErr ...error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) GetCode

func (e *Error) GetCode() string

func (*Error) GetMessage

func (e *Error) GetMessage() string

func (*Error) GetType

func (e *Error) GetType() Type

func (*Error) Native

func (e *Error) Native() error

type Template

type Template struct {
	Code  string `bson:"code" json:"code"`
	Label string `bson:"label" json:"label"`
}

func NewTpl

func NewTpl(code string, label string) *Template

func (*Template) Error

func (t *Template) Error(args ...any) *Error

type Type

type Type = int32
const (
	TypeCoding Type = -999 // code error
	TypeSystem Type = -444 // system error
	TypeBiz    Type = -777 // biz error
)

Jump to

Keyboard shortcuts

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