logoalt Hacker News

samivtoday at 11:53 AM0 repliesview on HN

User entering wrong input is a logical condition and typically handling a logical condition (point being it's not an error from the software's operational point of view) using tools that allow easier logic flow (i.e. error codes) etc.

Out of memory error can happen in many environments because for example in C++ it's about the allocator. You might have a custom allocator with some limit that has no bearing whatsoever what the OS does.

  * Use asserts/panics for bugs.
  * Use "error codes/values/enums" for logical conditions (that are errors to the user, not errors to the software)
  * Use exceptions for unexpected errors in the execution of the software (normally more or less just resource allocation failures)