2 ms·
And in doing that, you demonstrated that the idiomatic default in Go error handling is unhandleable errors, the sort that forces programmers to pitifully parse
by tptacek 9y ago
And in doing that, you demonstrated that the idiomatic default in Go error handling is unhandleable errors, the sort that forces programmers to pitifully parse strings to differentiate.
I kind of love Go. I'm a former professional C programmer and Go is now my default language. But I don't feel a need to kid people about things Go gets wrong.
- sagichmal 9y agoIf the user can do anything with the error, then it is idiomatic to return a discrete, comparable error variable var ErrTryAgain = errors.New("...") or an error type with additional contextual information type RetryError struct { ... } These are both opt-in; if your users have no need to differentiate or act on errors, fmt.Errorf("...") is totally sufficient. You're acting as if this is some critical flaw in the language. It's nothing like that.