surdeus 7fe533fd71 Forking. | 11 months ago | |
---|---|---|
.. | ||
README.md | 11 months ago | |
errors.go | 11 months ago | |
errors_test.go | 11 months ago |
A package that provides enriched errors. It uses the same conventions and extends the Go standard errors package.
go get -u github.com/aukilabs/go-tooling/errors
err := errors.New("error message") // With a message.
err := errors.Newf("error message with format: %v", 42) // With a formatted message.
err := errors.New("handling http request failed").WithType("httpError")
err := errors.New("handing http request failed").
WithTag("method", "GET").
WithTag("path", "/cookies").
WithTag("code", 401)
err := errors.New("handling http request failed").Wrap(fmt.Errorf("a fake simple http error"))
err := errors.New("handing http request failed").
WithType("httpError").
WithTag("method", "GET").
WithTag("path", "/cookies").
WithTag("code", 401).
Wrap(fmt.Errorf("a fake simple http error"))
var err error
t := errors.Type(err)
var err error
foo := errors.Tag(err, "foo")