Hi there ,
I have problems with the behavior on some nested error handling procedures ! In case of an error, I would like to active the current’s procedure error handler, do some clean up code for that procedure, and return control to the parent’s procedure error handler and so on …
Let ‘s say we have the following code :
Sub Main()
On Error GoTo Err_Gen
...
Call Procedure A
...
GoTo EndProc
Err_Gen:
Err.Raise Err.Number, ".ReadIniFile: ", Err.Description
On Error GoTo 0
EndProc:
End Sub
-----------------
Sub A()
On Error GoTo Err_Gen
….
Call Procedure B
GoTo EndProc
Err_Gen:
Clean up code for Procedure A
Err.Raise Err.Number, ". Procedure A: ", Err.Description
On Error GoTo 0
EndProc:
End Sub
-----------------
Sub B()
On Error GoTo Err_Gen
….error happens here ...
GoTo EndProc
Err_Gen:
Clean up code for Procedure B
Err.Raise Err.Number, ". Procedure B: ", Err.Description
On Error GoTo 0
EndProc:
End Sub
The idea is that if an error occurs on Procedure B, it would activate B’s error handler, do some clean up code specific for that Procedure, and then pass control the procedure’s A error handler and so on. The problem is that ‘s procedure B is trying to dispay the error msg box …
Any ideas would be really appreciate it !!
Thanks
TrekFan
PS. By the way the procedures of the examples are implemented on different classes in different objects.
I have problems with the behavior on some nested error handling procedures ! In case of an error, I would like to active the current’s procedure error handler, do some clean up code for that procedure, and return control to the parent’s procedure error handler and so on …
Let ‘s say we have the following code :
Sub Main()
On Error GoTo Err_Gen
...
Call Procedure A
...
GoTo EndProc
Err_Gen:
Err.Raise Err.Number, ".ReadIniFile: ", Err.Description
On Error GoTo 0
EndProc:
End Sub
-----------------
Sub A()
On Error GoTo Err_Gen
….
Call Procedure B
GoTo EndProc
Err_Gen:
Clean up code for Procedure A
Err.Raise Err.Number, ". Procedure A: ", Err.Description
On Error GoTo 0
EndProc:
End Sub
-----------------
Sub B()
On Error GoTo Err_Gen
….error happens here ...
GoTo EndProc
Err_Gen:
Clean up code for Procedure B
Err.Raise Err.Number, ". Procedure B: ", Err.Description
On Error GoTo 0
EndProc:
End Sub
The idea is that if an error occurs on Procedure B, it would activate B’s error handler, do some clean up code specific for that Procedure, and then pass control the procedure’s A error handler and so on. The problem is that ‘s procedure B is trying to dispay the error msg box …
Any ideas would be really appreciate it !!
Thanks
TrekFan
PS. By the way the procedures of the examples are implemented on different classes in different objects.