Re:IBM to buy HashiCorp in $6.4B deal
by hpeter on Thursday April 25, 2024 @09:29AM
(#40157309)
I prefer to handle errors than ignore them. "If err" is actually one of the best things about Go
[ Parent
| on HN ]
Re:IBM to buy HashiCorp in $6.4B deal
by renegade-otter on Thursday April 25, 2024 @11:52AM
(#40159015)
In most web applications I write, I have one error-handling block.
Access forbidden? Log a warning and show a 403 page. Is is JSON? Then return JSON.
Exception-handling in general is a pretty small part of most applications. In Go, MOST of the application is error-handling, often just duplicate code that is a nightmare to maintain. I just don't get why people insist it's somehow better, after we "evolved" from the brute-force way.
Errors usually happen during IO, but not in the main business logic and those two can be neatly separated.
But If you are coming from java I can understand the single error handling block is more comfortable, but coming from JavaScript/Typescript it's much more easy to check if err != nil, than to debug errors I forgot to handle, during runtime.