swarm icon indicating copy to clipboard operation
swarm copied to clipboard

Error propagation, annotation and handling

Open janos opened this issue 6 years ago • 0 comments

Consolidate error handling and improve error messages. Errors should be constructed so that it is safe to expose them to the user revealing as less as possible implementation details.

  • Errors must be propagated by the caller function
  • Error should not be logged and passed at the same time
  • It is up to the next caller function to decide what should be done in case of an error
  • If a function has multiple returns with, any returned error should be annotated either with fmt.Errorf using %w verb or with custom error type that has Unwrap method

janos avatar Dec 11 '19 14:12 janos