I am tired of seeing
SocketException: hostname.com
as full error message.
I am tired of seeing
SocketException: hostname.com
as full error message.
Certainly any shortcut syntax should not prevent you from adding human-curated context to your errors. But the current situation comes at an enormous cost, and I truly think there's a bit of Stockholm Syndrome going on here.
If you use the full stacktrace, you could get 50 frames of irrelevant library code worsening the signal:noise ratio, hiding what the real issue is.
If you write your own context, then when it _is_ a problem with library code, you're hopelessly lost.
I think we need better tooling: the ability to add your own contextual information, to propagate errors explicitly but without boilerplate, and the ability to _choose_ the level of information you see afterward.
We have log viewers that can filter out by severity level, why don't we have a standardization for stack traces to let you filter to what you want?
I don't think Go errors are perfect either as you just tend to concatenate strings together but the information they include are more user friendly if done right, i.e. not just bubble up the error, but adding context that the user is aware of.
I say this as an ex-(for now)-Python dev, currently suffering though Go's tedious error handling.
My opinion is that a syntax shortcut such as "?" to just bubble up errors without adding context would still be useful. I would welcome it. There are cases where I find that no additional context is needed. I think the Go designers are afraid what it would lead to though (the laziness wins out hypothesis)
Try debugging something in Spark/DataBricks. It is so incredibly tedious; stack traces can easily reach 200 lines or more.
I agree in sense Stockholm Syndrome going on but not just for Go but with almost every technology including Go.
When we have folks defending Rust slow builds, Swift breaking changes, Half-assed tooling for Scala, poor power management on linux laptops and on and on. It could mean either plain old stockholm syndrome or that people can work around these minor irritants and get main benefit of technology. Just like with anything else in life.
Stacktraces are better than just bubbling up, and yes a mechanism to minimize if-err could also allow for human annotations.
I'd love if Go had a stronger type system, but I know it'd probably come with longer compile times like Rust has. I think it's not a dogmatic take, and I think a lot of golang proponent do take the same nuanced position.
[0] https://ziglang.org/documentation/master/#Error-Return-Trace...
x, err := f(); if err != nil return fmt.Errorf("More context -> %s", err)
(I'm not attached to that specific syntax, it's just an example of a hypothetical one-liner)