4 ms·
This was my original take when I learned the language, but I later realised “errors as values” is one of the strengths of the language. I have run both Go and
by Arbortheus 28d ago
This was my original take when I learned the language, but I later realised “errors as values” is one of the strengths of the language.
I have run both Go and Python backends in production for years. There is an entire class of bugs present in Python services (missing error handling) that simply does not happen in my Go services.
Python puts the burden of knowing what exception types a function call will raise on the caller, in Go I just check for err. Even if I do not anticipate every failure mode the Go call will raise, I will always log the error and handle it in a controlled manner. I couldn’t count the number of times I’ve encountered an unhandled exception in my Python code, and often in such a case the logging will be lacklustre because you will just see a huge stack trace, but lose the contextual logging I would have automatically added in Go.
Perhaps a syntactic sugar is in order to reduce verbosity.
- Fervicus 28d agoI don't have a problem with the error handling per say, but it's the verbosity, yes.