Sunday, August 22, 2021

Errors At 99

Excellent post on go errors.

Basically the TLDR was:

  • panic if you want Bugsnag
  • Wrap errors in general go code, it should look like this
// in go func
fmt.Errorf("operation failed: %w", err)

// in caller func
errors.Unwrap(err)
  • Use twirp errors if we want the client to do something with the error, here is a list