Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Bubbles68264yNew to the go community, do you know if they plan on fixing or improving the error handling?
-
Bubbles68264y@Marl3x I just know it’s one of the bigger complaints I hear about Go, aside from the large binaries and lack of generics
-
Oh, and there I was thinking that I'll learn Go and be happy about knowing another peice of performant language. Guess not this year.
-
hjk10157314yThere are plenty of ways to do it with the conducts go provides. From defer panic recover to closure and handler functions. You just need other design patterns.
-
Kaivo1624yI've been using it on one project while reading the go programming book. Apparently early return is the way to go for error so you don't nest too much. At least you know you handled the error.
What I'm not sure I did right yet is returning different type of errors with interface implementing the Error method so I could act according to the error type from the caller side. It felt messy.
Overall, it feels like most functions is 15 lines of error handling and defers for 5 lines of business logic
Related Rants
-
xorith19HTML: Hate This Meaningless Life CSS: Can't Style Shit JS: Just Shit Java: Just another vicious asshole PH...
-
k0pernikus15Me: We should change the http response code to anything but 200 OK in the error response case of our API. Oth...
-
ObiSwagKenobi6> Receive sudden phone call in the middle of the night > Check caller, unknown number > "Either something ba...
Golangs error handling is really annoying. I'm writing a cli that does a bunch of stuff, and a lot of that could cause an error. Now I have to either explicitly ignore the errors everywhere or write an abundant if, that simply checks if the error exists and print it to console. So I either won't see any errors when something goes wrong, or I will have ugly bloated code... wtf, I want "throw" back
rant
error handling
go
golang