Poll: Is my question clear ?
You do not have permission to vote in this poll.
Yes
100.00%
2 100.00%
No
0%
0 0%
Total 2 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
vb script to stop execution of functions if conditions fail
#2
Not Solved
your approach should be like the code written below for your reference.
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 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.
Reply


Messages In This Thread
RE: vb script to stop execution of functions if conditions fail - by ravi.gajul - 12-05-2013, 12:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question adding two conditions into a while statement lotos 4 5,093 11-10-2017, 04:49 AM
Last Post: lotos
  UFT 12.02 Compatibility for IE 11.0 : Fail to identify the defined Object Amruta_121 9 11,195 01-11-2016, 12:45 PM
Last Post: vinod123
  Inserting variable values into Descriptive Programming Functions eske99 2 3,521 12-18-2015, 01:47 PM
Last Post: vinod123
  How to catch the script execution when QTP scripts are executed from command line Sreeni.lutukurthy 0 2,943 03-19-2015, 05:55 PM
Last Post: Sreeni.lutukurthy
  Passing objects to Functions vinod.nhce 0 3,300 03-13-2014, 06:09 PM
Last Post: vinod.nhce

Forum Jump:


Users browsing this thread: 2 Guest(s)