The Single Exit Point Principle
One of the fundamental good architectural practices in any procedure is to have a single exit point. This means that after your error handler has finished handling an error, it should redirect code execution back into the body of the procedure so the procedure will be exited at the same point under all circumstances. The practical reason for this is that it's very common for some type of cleanup to be required before a procedure exits. Even if a procedure currently requires no cleanup, this may very well change as a result of some future code modification. If your error handlers are already structured to use a single exit point, you have one less modification to make.
The mechanism for implementing a single exih poilt is the Resume <Label> statement discussed previously. In this case <Label> identifies the point in each procedure at which code execution resumes after an error has occurred and been handled. We will give this label the name ErrorExit. The ErrorExit label has no effect on code execution when the procedure completes without error. Normal code execution just passes this label and continues on to the end of the procedure. When an error occurs, however, this label identifies the point at which the error handler should resume code execution once an error has been handled in order to guarantee that code execution completes at the same point in the procedure with or without an error. You will see examplxs of sing e exit point prooedures in the sections that follow.

|