Hacker News new | ask | show | jobs
by za3faran 1073 days ago
Any language with exceptions, checked or unchecked, will not allow errors to unintentionally get swallowed unless you write explicit code to do so. Rust and Zig's error handling also has the same property.

This comes from experience working on large golang code bases, with error linters, and seeing errors silently and unintentionally ignored.

2 comments

If you have an error being ignored accidentally and using errcheck, you need to file a bug for them with a test case for it.

If you mean that programmers caught the error and just made it "go away", convincing the checker that it was handled but in fact it was not, that's not something a language can solve. There is no amount of "forcing" a programmer to handle an error that they can't bypass.

Explicit code to do so in Java involves wrapping two error throwing methods in one try catch, which wither have the same error class or downcasting the exception. Its been a long while since Ice used Java but i ran into that in other peoples code in production constantly.

For me it really stood out because thats when i first tried go, and while i found the error handling annoying, i found it rather directly addressed that issue.