Hacker News new | ask | show | jobs
by macrael 2868 days ago
So you then define your function to return the type DBError instead of a generic err type. That makes sense to me but for some reason some of the stuff I've suggests that just returning err is more go-like.
1 comments

No, you don't, DBError should implement the error interface.

IsTemporary also takes an error and does something like:

  if err, ok := errors.Cause(err).(*DBError) {
    return err.temporary
  } else {
    return false
  }
oooh!