mirror of https://github.com/aldy505/decrr.git
Reinaldy Rafli 5061b1c29c | ||
---|---|---|
.github | ||
.gitignore | ||
LICENSE | ||
README.md | ||
decrr.go | ||
decrr_test.go | ||
go.mod |
README.md
Decrr
A modification (and a bit of simplification) of the tracerr package.
This essentially does pretty much the same, but instead of returning another struct like tracerr package does, this decorate the error and return another regular error type.
Usage
Simply put it on the deepest function/method on your project.
package main
import "github.com/aldy505/decrr"
func main() {
err := ExecuteSomething()
log.Fatal(err)
}
func ExecuteSomething() error {
return SomethingElse()
}
func SomethingElse() error {
err := errors.New("a goat just passes by!")
return decrr.Wrap(err)
}
And yes, it only has one .Wrap(error)
function. Nothing else.