It is not possible to handle errors that arise inside error-handling code. Therefore, the declaration of a new error handler within an error-handling section will lead to unpredictable behavior, since the second error-handling routine is activated only after the first error handler has exited.


== Noncompliant Code Example

----
Sub InitializeMatrix(Var1 As Integer, Var2 As Integer, Var3 As Integer, Var4 As Integer)
    On Error GoTo ErrorHandler
    '. . .
    Exit Sub
ErrorHandler:
   On Error GoTo ErrorHandlerLastResort
    '. . .
    Resume Next
ErrorHandlerLastResort:
   '. . .
   Resume Next
End Sub
----


== Compliant Solution

----
Sub InitializeMatrix(Var1 As Integer, Var2 As Integer, Var3 As Integer, Var4 As Integer)
    On Error GoTo ErrorHandler
    '. . .
    Exit Sub
ErrorHandler:
    '. . .
    Resume Next
End Sub
----

