> Throwing an exception does not necessarily mean that your program is suddenly in an unsupported state
When everyone uses runtime exceptions and doesn’t count for exception handling in every possible code path, that’s exactly what it means.
When everyone uses runtime exceptions and doesn’t count for exception handling in every possible code path, that’s exactly what it means.
When you work with exceptions, the key is to assume that every line can throw unless proven otherwise, which in practice means almost all lines of code can throw. Once you adopt that mental model, things get easier.
It also makes errors part of the API contract, which is where they belong, because they are.
The point about being explicitly part of the API stands, though.