gerrors

package
v0.0.0-...-047dcd9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNil            = error(nil)
	ErrNotExist       = stdErr.New("not exist")
	ErrAlreadyExist   = stdErr.New("already exist")
	ErrNotFound       = stdErr.New("not found") // This is not a really run error, it means Database/Collection not exist in mongodb.
	ErrNotSupport     = stdErr.New("not support")
	ErrNotImplemented = stdErr.New("not implemented")
)

Error number.

Functions

func Errorf

func Errorf(format string, args ...interface{}) gerror

func GetStack

func GetStack(err error) string

Get stack for 3 types of error.

func IsGerror

func IsGerror(err error) bool

func New

func New(format string, args ...interface{}) gerror

New error.

func NewExt

func NewExt(isFatal bool, errNum string, format string, args ...interface{}) gerror

New error with details.

func Wrap

func Wrap(err error, message string) gerror

Wrap error to GErr.

Types

type GErr

type GErr struct {
	IsFatal bool
	Num     string
	Msg     string
	Stack   string
}

Implementation structure of gerror.

func (*GErr) Details

func (ge *GErr) Details() GErr

Implements gerror interface.

func (*GErr) Error

func (ge *GErr) Error() string

Implements error interface, stack will not display in output.

func (*GErr) SetErrNum

func (ge *GErr) SetErrNum(errNum error)

Implements gerror interface.

func (*GErr) SetFatal

func (ge *GErr) SetFatal()

Implements gerror interface.

Jump to

Keyboard shortcuts

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