errs

package
v0.0.0-...-20fd351 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTypeFramework = 1
	ErrTypeBusiness  = 2
)
View Source
const (
	ErrCodeSuccess = 0
	ErrCodeUnknown = 9999

	ErrMsgSuccess = "success"
)

Variables

View Source
var (
	ErrTypeMap = map[int]string{
		ErrTypeFramework: "framework",
		ErrTypeBusiness:  "business",
	}
)

Functions

func ErrCode

func ErrCode(err error) int

ErrCode get error code

func ErrMsg

func ErrMsg(err error) string

ErrMsg get error msg

func New

func New(code int, msg string) error

New new error

func NewFrameworkErr

func NewFrameworkErr(code int, msg string) error

NewFrameworkErr new framework error

func Newf

func Newf(code int, format string, args ...interface{}) error

Newf new formatted error

Types

type Err

type Err struct {
	Type int
	Code int
	Msg  string
}

Err error wrapper

func (*Err) Error

func (e *Err) Error() string

Error error

Jump to

Keyboard shortcuts

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