I actually love Rust's error handling. It's definitely more verbose than other languages', but handling it as an enum, including it in the signature, AND having the compiler force you to handle these things is perfect. If things can fail, you should be forced to handle it.
jokes aside, i love it, when errors do get thrown without being handled it could be a bit clearer as to what went wrong but its just nitpicking at that point, its vastly better than spamming try catch
Honestly, I think adding unwrap() and expect() was the biggest mistake Rust ever made. Panicking on an error should not be that easy. A ton of new Rust devs treat unwrap() as an incantation that makes the code compile, and they completely bounce off of the beautiful error handling system as a result.
The entire problem is with how much line noise this pollutes your codebase with...
5 out of 9 different languages in the original post force you to handle errors, but Go (and occasionally Java) is unique in it's verbosity, it produces enough ceremony for people to complain about it.
Personally I find throwing exceptions and expecting callers to handle more problematic.
Theoretically you can ignore err returns in Go but it forces you to think about most possibilities up front. Agreed it is verbose but as I used the language more I found it more of a blessing.
Everyone is entitled to differing opinions though.
If you want to ignore a returned err in Go, you have to specifically name it _, otherwise the compiler will yell at you for not using the variable. There are some cases where you could miss an error if you are using the same variable name for a long series of errors and checking each of them, but in general I also think it's a good system.
View all comments
66
u/coldnitrogen Oct 24 '26
Go error handling isn't bad. I'd actually prefer it to Try-Catch blocks