I am asking this question more as input/feedback on error handling strategies than as a purely technical question.
As I try to enhance the robustness of my code, one of the factors I am considering is the error handling.
In particular, I am considering adding a seperate error handling section for each function. Is this overkill?
As I write every "subprocedure" as a function (returning 0 on success, error number otherwise) I can see the problem with program flow: every successive step needs to check the preceeding steps' (or functions) return values. And my main function consists of a bunch of statements similar to...
If Not intErrorValue Then intErrorValue = intPerformNextFunction(blah1, blah2, blah3)
Would I be best to provide only specialized error handling where needed, and let the majority of error fall into a centralized error handling procedure? This would seem to relieve me of constantly checking my interal error values and the overhead of creating the error handling (no matter how simple) for each function.
I suppose that centralized error handling is the way to go. Perhaps this would be best viewed as being similar to flying a plane... turn the autopilot on, and leave it alone unless you really need to.