News for hackers. Stuff that matters.
Re:Why I’m Frustrated with Go by dullgiulio on Sunday July 23, 2017 @08:46AM (#14831999)
>> the entire error thing is absurd. Anders Hejlsberg got th is right many years ago: 9 out of 10 errors are "handled" by a central error handler

> This is almost always unacceptable in production, especially when it comes to mission critical hard/software. You need to be able to handle errors in production that you may not even be able to catch in testing and that means you need to catch all the errors and think critically about what should be done when that error is encountered.

Absolutely. My approach is usually that errors are always wrapped not just returned. The wrapping itself ends up looking almost like code documentation: "could not do X: <previous error>", "error while doing X: <previous error>". Every error string is then unique in the program, easy to grep.

"Could not perform the operation", maybe together with a 500 lines stacktrace in your logs (which are maybe line-by-line bacause that's the default)... you are up to a nice middle of the night debugging session :)

Re:Why I’m Frustrated with Go by rufugee on Sunday July 23, 2017 @11:12AM (#14832594)
The problem I've found it that you might wrap errors this way, but the libraries you use don't, or approach it differently. So you're either chasing down strings that may or may not be grep'able or you're fighting with delve to track down what's happening. The whole error situation with Go is one of the main drawbacks of the language imho.
Re:Why I’m Frustrated with Go by jorgec on Sunday July 23, 2017 @09:35AM (#14832190)
When you wrap the error then you are kicking it out. Sooner or later you must catch the error. So, in most case, its just delaying the inevitable.
Re:Why I’m Frustrated with Go by dvirsky on Sunday July 23, 2017 @09:06AM (#14832090)
Exactly, once you wrap errors with their context, or just at the lowest level wrap it with a stack trace, they become much more useful.