02-23-2011, 01:47 AM
I believe you are clearing the error values when you call the function. If this were a normal function, you could pass it the Err object and I think you would preserve your error information. Since this function is triggered by an error in the script and you can't control the parameters (I don't think you can), I don't think this is going to work.
In the QTP 10 help, you can find "Recovery Scenario Wizard, Function screen" and it will show you useful info on creating a recovery functiton. It says that the recovery function for a test run error has the first parameter as an object that represents the object that had the error. One of this object's attributes is "Result" which is defined as "The actual method's results". I'm guessing that this is probably your error number.
After you select a function library, choose one of the following options:
Select function. Choose an existing function from the function library you selected.
Only functions that match the prototype syntax for the trigger type selected in the Select Trigger Event Screen are displayed.
Following is the prototype for each trigger type:
Test run error trigger
OnRunStep
(
[in] Object as Object: The object of the current step.
[in] Method as String: The method of the current step.
[in] Arguments as Array: The actual method's arguments.
[in] Result as Integer: The actual method's result.
)
Pop-up window and Object state triggers
OnObject
(
[in] Object as Object: The detected object.
)
Application crash trigger
OnProcess
(
[in] ProcessName as String: The detected process's Name.
[in] ProcessId as Integer: The detected process' ID.
)
In the QTP 10 help, you can find "Recovery Scenario Wizard, Function screen" and it will show you useful info on creating a recovery functiton. It says that the recovery function for a test run error has the first parameter as an object that represents the object that had the error. One of this object's attributes is "Result" which is defined as "The actual method's results". I'm guessing that this is probably your error number.
After you select a function library, choose one of the following options:
Select function. Choose an existing function from the function library you selected.
Only functions that match the prototype syntax for the trigger type selected in the Select Trigger Event Screen are displayed.
Following is the prototype for each trigger type:
Test run error trigger
OnRunStep
(
[in] Object as Object: The object of the current step.
[in] Method as String: The method of the current step.
[in] Arguments as Array: The actual method's arguments.
[in] Result as Integer: The actual method's result.
)
Pop-up window and Object state triggers
OnObject
(
[in] Object as Object: The detected object.
)
Application crash trigger
OnProcess
(
[in] ProcessName as String: The detected process's Name.
[in] ProcessId as Integer: The detected process' ID.
)