Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's a strange idea of what "happy path" means. An invalid request is, by definition, an error or exception.


That assertion is obviously wrong. Think about it: you have a web server listening to the world. Do you really expect all requests to be neatly pointing to sanitized URLs? Of course not. Why on Earth should you assume that handling invalid requests is not one of the primary use cases?


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: