2 ms·
Logging can be a valid handling of error. I just don't believe that most errors can be handled locally so besides returning an error (bubbling up), not much ca
by gf000 2y ago
Logging can be a valid handling of error.
I just don't believe that most errors can be handled locally so besides returning an error (bubbling up), not much can be done. Go makes this part of the happy path, so neither can be easily seen/reasoned about anymore.
Exceptions do auto bubbling up, while languages with ADTs have more strictness than go, and often have some syntactic sugar/macro to help with the common case of returning the error (rust's ?).
- kgeist 2y ago>I just don't believe that most errors can be handled locally so besides returning an error Sure, but explicit error handling reminds you that the call may fail, and you may want to handle it in some way (or not - then you bubble it up). With exceptions, it creates the illusion of a simple linear flow.