surdeus 7fe533fd71 Forking. | il y a 11 mois | |
---|---|---|
.. | ||
README.md | il y a 11 mois | |
errors.go | il y a 11 mois | |
errors_test.go | il y a 11 mois |
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")