The only downside to this is you can no longer treat errors as values. Eg, you can't do:
err := Func()
if err == ErrBadThing {
// do stuff
}
So you have to implement some type of `Cause()` method. In my lib, i have `errors.Cause()` which returns the root error, as well as a shorthand func `errors.Equals(err, ErrBadThing`)`
The only downside to this is you can no longer treat errors as values. Eg, you can't do:
So you have to implement some type of `Cause()` method. In my lib, i have `errors.Cause()` which returns the root error, as well as a shorthand func `errors.Equals(err, ErrBadThing`)`