by Geezus_42 · 7mo ago · 0 comments
I.E. Instead of "<DOMAIN> TLS Handshake failed" it will be something like "ERROR: PKIX failed". So now I have to figure out that PKIX is referring to PKI and it would make too much sense to provide the domain that failed. Instead I have to play the guessing game.
Java has proper error messages with a full stack trace that tells the whole story.
Of course individual developers may lazy out on writing useful error messages, but that's hardly a Java issue.
Meanwhile in Go you can be happy to have any error message at all. And then you can hope it's a unique string you can grep in a codebase. Where you only may find a line of code you could have arrived from many different places.
So the full message would be like "Cannot add item X to cart Y: Error connecting to warehouse Z: Error establishing TLS connection to example.com 127.0.1.1: PKIX failed".
I.E. ERROR: TLS handshake failed: <DOMAIN> certificate chain unverified
Just like your example: single line, to the point and loggable. e.g.
writing foo.zip: performing http request (bar.com): tls: handshake: expired certificate (1970-01-01)
Exceptions with stack traces are so much more work for the reader. The effort of distilling what's going on is pushed to me at "runtime". Whereas in Go, this effort happens at compile time. The programmer curates the relevant context.For what it’s worth, the rise of helpful error messages seems to be a relatively new phenomenon the last few years.
The difference really becomes apparent when trying to debug a customer's problem at 3am (IME).
There is no ecosystem I would choose over Java when it comes to observability and it's not even close.
Good luck finding your segfault, oom, race condition or just simply lazy logging culture bug with a C/go codebase at 3am.
I will happily see my proper stack trace, heap dump, or connect directly to prod with a debugger with basically no performance penalty.
And if you're not catching N levels up but catching at each level, then you are emulating error values but with try/catch blocks.
I do not want a stack trace unless I specifically request it. I am not a Java developer, 10 pages in less showing names of packages I don't even know what they are is not useful. It just muddies the water so that it's much harder to make sense of and spot the relevant line; assuming there is a line that actually states the error. I shouldn't need to know what all those packages are in order to figure out why Confluence crashed again or stopped sending emails.