gerrors

package
v0.0.0-...-04ff805 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 8 Imported by: 7

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")
	ErrTimeout        = stdErr.New("timeout")
)

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 Join

func Join(err error, errs ...error) error

Join combine multiple errors to one error.

func JoinArray

func JoinArray(errs []error) error

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