News for hackers. Stuff that matters.
Re:My Go Resolutions for 2017 by notheguyouthink on Wednesday January 18, 2017 @01:37PM (#13428959)
Yup, my solution as well. As well as a couple other common libraries (eg: https://github.com/pkg/errors)

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`)`

There are no comments on this comment yet.