swarm
swarm copied to clipboard
Error propagation, annotation and handling
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