Hacker News new | ask | show | jobs
by treyd 474 days ago
Rich type systems like Rust's do completely prevent this type of mistake. You don't need unit tests to ensure that the error condition is handled somehow because we statically assert it within the type system of the language.
1 comments

Handling an error is pointless if you don't handle it correctly, and for that you need unit tests anyway, so you still need to write the tests and once you've done that it is impossible to encounter the mistake without knowing it no matter how you slice it.

But your editor can give some more realtime feedback instead of waiting for your tests to run, so I guess that's cool.

You need to give it a try
Give improperly handling an error a try? I’m good. I prefer my software to function correctly.