Categorygithub.com/tikafog/errors
modulepackage
0.1.2
Repository: https://github.com/tikafog/errors.git
Documentation: pkg.go.dev

# README

Errors

Errors is an object for modular error management package

Useages

var err = errors.RegisterModule("name")
var (
ErrFirstErr = err.New("first err")
ErrSecondErr = err.Errorf("%v", "second err")
)

func doSomething() error {
//...
return ErrFirstErr
}

func doSomething() error {
//...
return err.New("third err")
}

func doSomething() error {
//this will only return an error wrapped from errors
return errors.New("fourth err")
}

func doSomething() error {
//...
err := doAnything()
return err.Wrap(err, "fifth err")
}

func doSomething() error {
//...
err := doAnything()
return err.WrapIndex(err, ErrFirstErr) Index
}


if used module errors, the error will print like this:

    Module[name]: first err

otherwise,the error will print like this:

    fourth err

Other

there two functions will register errors to the unknown module

func IndexNew(str string) Index 
func IndexErrorf(format string, args ...interface{}) 

others are used same as errors

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IndexError @param Index @return error Decrypted use ErrorIndex instead.
No description provided by the author
No description provided by the author
IndexModule ...
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
StringError @param string @return error Decrypted use ErrorString instead.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

Index is used for make error index.