12-05-2013, 12:26 AM
your approach should be like the code written below for your reference.
This means each function should be called from "CodeToBeExecutedWithErrorHanlder" function. When error occurs in the called function it returns back to the calling function and in calling function because we have on error resume next...it proceeds to the next step where error number is checked and based on the error number you can decide whether or not to continue with the remainder of the test execution.
This should help you.
Code:
Dim globalErrHanlder
OnErrorGoTo "errHandler"
'Execute the Error wrapper function
Call CodeToBeExecutedWithErrorHanlder()
Function CodeToBeExecutedWithErrorHanlder()
On Error Resume Next
Call TestErrorHandler()
If Err.Number <> 0 Then
Call globalErrHanlder(Err.description)
End If
End Function
Public Function OnErrorGoTo(byVal FunctionName)
Set globalErrHanlder = GetRef(FunctionName)
End Function
Public Function errHandler(des)
msgbox "Fail" &"Error Occured" &des
End Function
Function TestErrorHandler()
x=1/0
msgbox x
End Function
This should help you.