| > What if you don't control those call sites? If I am choosing to change the API contract then someone who wants to use the new API has to update. This is not a big deal. > If the function doesn't use exceptions for normal error conditions, then no, it's not a new contract I disrespectfully and emphatically disagree. I do not accept your definition of contract. > You could do something like (try-catch wrapper) Let me be clear. Having to add a bunch of random fucking try-catch bullshit around every fucking function call is EXACTLY why I hate exceptions and is EXACTLY what I think is bad software design. If you think a function should return a value or some unspecified exception whose details are irrelevant then that function could return an option with no information loss, or a result with an Error that is ignored. > You wouldn't iterate a vector like this, I imagine? I wouldn’t use at(i) for iteration. The only reason for a function like at(i) to exist is because you want it to be fallible. |
The whole point of exceptions is that you don’t need to handle errors at every call site. You can just have one central try-catch block at a place where you have a way to deal with the error, such as report it to the user.