Hacker News new | ask | show | jobs
by sixplusone 2313 days ago
You and flqn are trying to convince me that expected errors are not errors https://en.wikipedia.org/wiki/Happy_path

When I want a parameter is an integer, I don't check all the ways in which it's NOT an integer; the happy path is when it _is_ an int and the program can continue, and anything else is an _Error_. If it overflows, that's an error too.

i.e., happy means it's basically the longest path (aside from diagnosing the error).

The question is: should the subroutine set an error number or throw an exception? Knowing the cost for each might help me decide for various situations.