Added README
This commit is contained in:
parent
604df67596
commit
5c9f18d953
26
README.md
Normal file
26
README.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
```
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
// External
|
||||||
|
werr "git.gibonuddevalla.se/go/wrappederror"
|
||||||
|
|
||||||
|
// Standard
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func errorHandler(err werr.Error) {
|
||||||
|
// For example print or log error to file
|
||||||
|
fmt.Printf("ERROR - %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func foo() {
|
||||||
|
werr.SetLogCallback(errorHandler)
|
||||||
|
|
||||||
|
err := errors.New("foobar 1")
|
||||||
|
err1 := werr.Wrap(err)
|
||||||
|
|
||||||
|
err2 := werr.New("foobar 2")
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user