DEV Community


Discussion on: Golang through the eyes of a Java developer - pros and cons

aminmansuri profile image

Frankly, I love checked exceptions. I think they are a great feature. They're just misunderstood and maligned by Bruce Eckel who didn't get them.

But they make my code much cleaner because I use them properly.

It's fine if some languages are not as strict with types or errors than others. But that was Java's philosophy and I have no problem with it.

Putting if/else error checking is definitely a step backward.

I guess a better way to do error handling in Go would be to return a "result" object that would have an "value()" method to return the value, or an "ifError()" method to handle the error with a lambda.

But the nice thing about exceptions was being able to largely forget about them and let them trickle up to some handler. But it seems to be a hard concept for some people for some reason. Error codes aren't better.