How you are contextualizing errors?

What you guys do to contextualize errors? I’m using pkg/errors, it’s amazing. Today, i’m contextualizing all errors, so, whenever a function returns a error, i wrap and contextualize it.

The final messages make a lot of sense, i know exact where the problem is, but it is very verbose and annoying.

So when and how you guys contextualize the errors?

  • on all errors
  • only at the return of public methods/functions
  • only when it’s handled
  • i prefer to panic :smile:

Doing microservices here and we keep them decently small (medium). So each error that breaks the flow (cannot be ignored) will panic.

Not sure it is the best approach, but so far we can pull it off.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.