3 ms·
What I meant about abstraction is that if you define a function which returns an error struct instead of an error interface, you lose any abstraction capability
by tsimionescu 7y ago
What I meant about abstraction is that if you define a function which returns an error struct instead of an error interface, you lose any abstraction capability, you can only return that specific struct (and need to find some way of signaling that no error occurred).
- weberc2 7y agoAh, I see. Yes, that’s true. You would need to return a bool alongside it or similar, but the best practice is to use an interface for sure.