4 ms·
I too, have found error handling in Go to be quite good even if it is verbose. I like knowing where exactly an error has come from and that the language makes m
by bGl2YW5j 8y ago
I too, have found error handling in Go to be quite good even if it is verbose. I like knowing where exactly an error has come from and that the language makes me think about how to handle them before continuing.
> ...but not annoyed by errors they don't care about. Telling which from which is highly contextual, and the language rarely has that knowledge.
Isn't this where the programmer's knowledge + a little thinking come into it? With experience you come to understand what kind of errors certain functions will return and then you spend a little time thinking about the context this error may appear. With this you determine whether the error has to be handled or can be safely ignored via a '_'.
- orangecat 8y agoWith this you determine whether the error has to be handled or can be safely ignored via a '_'. In my experience most of the time I want to neither explicitly handle the error nor ignore it. I want it to propagate up to a top-level handler that logs it and either fails the current operation or aborts the entire program.