Hacker News new | ask | show | jobs
by zzzcpan 2769 days ago
And yet forcing the caller to deal with errors still doesn't prevent improper state in any way.
1 comments

It does if they don't handle the exception, which is the situation being described.
Errors cause side effects, which is how you get to improper state. How does forcing the caller to handle errors helps with removing side effects?
Because the caller either deals with the error (and fixes the state) or they don't, but there's never a case where the callee was unable to force the caller to fix the state. If the caller then goes on to just handle/suppress the exception and continue with the invalid state, then at least they're making an explicit decision that is on them.
That's the point, forcing to handle errors doesn't force to do it properly.
It's still strictly better than just letting people not bother to handle them, which is never proper.
Is that true? What if you have an error that happens once every 10^9 requests and the service failure isn't critical (no one dies). Isn't it better to just not bother with the error, let the service keep running and don't worry about it?
"perfect is the enemy of good"