If you want to encourage best practices, use exceptions. This, at least, will make them realize that something is happening if they simply neglect something. If they bury an exception, they bury it. But this requires an active solution.
Basically, every time your code can go βIβm at the point where there is a problem, and the solution is either absent or ambiguousβ - this is when to quit.
Aside from throwing exceptions when you return control back to the caller, you can do nothing programmatically to ensure that they then do it.
source share