3 ms·
Look at how much additional boilerplate it took in your example to ignore the error. In the Rust case you just don’t call unwrap() if you want to swallow error
by kortilla 11mo ago
Look at how much additional boilerplate it took in your example to ignore the error.
In the Rust case you just don’t call unwrap() if you want to swallow errors like that.
It’s also false that catching all exceptions is how you end up with reliable software. In highly available architectures (e.g. many containers managed by kubernetes), if you end up in a state where you can’t complete work at all, it’s better to exit the process immediately to quickly get removed from load balancing groups, etc.
General top level exceptions handlers are a huge code smell because catching exceptions you (by definition) didn’t expect is a great way to have corrupted data.
- mike_hearn 11mo agoThe error wasn't ignored, it was logged (and it's an example on a web forum, in reality you'd at least increment a metric too and do other things). > General top level exceptions handlers are a huge code smell And yet millions of programs have such things and they work fine. My experience has been that they tend to be more reliable than other programs. E.g. IntelliJ hardly ever tears down the entire process when something goes wrong, it fails gracefully and reports back to HQ whereas other IDEs I've used hard crash quite regularly. Much more disruptive.