Re:Bugs that the Rust compiler catches for you
by lenkite on Friday May 06, 2022 @05:17AM
(#31283058)
Frankly, I love Java's checked and un-checked exceptions differentiation even if the standard library is confused about it.
Make logical exceptions (depending on purpose of interface) into checked-exceptions. Make system exceptions into un-checked exceptions. Document in javadoc with `@throws`
A higher level module can wrap and re-throw into the appropriate exception if needed.
Error handling can be done in the desired place instead of scattered across the code.
Re:Bugs that the Rust compiler catches for you
by kaba0 on Friday May 06, 2022 @05:28AM
(#31283135)
Yeah, I also believe that Java is the closest to the best error handling I am aware of. Unfortunately though, it is inheritance based which is a bummer here. It would be perfect with sum types though.
Make logical exceptions (depending on purpose of interface) into checked-exceptions. Make system exceptions into un-checked exceptions. Document in javadoc with `@throws`
A higher level module can wrap and re-throw into the appropriate exception if needed.
Error handling can be done in the desired place instead of scattered across the code.