Hacker News new | ask | show | jobs
by tuxxy 2213 days ago
The example cited where they don't know what to return in their `divide` function if a division by zero occurs is nonsense.

The answer is simple: let the `DivsionByZero` exception raise! You don't have to return anything!

Better yet, you should have input cleansing/data validation before it gets to that point. The alternative presented in the blog post is absurd over-engineering.