Implementing the GetLastError Method: Reporting Errors

When the RunEx or Run method returns a result other than success or throws an exception, UFT One calls the GetLastError method. Implement this method to return a string that UFT One can display in an error message box. Ideally, the error message is in the locale of the computer running the test.

UFT One uses HRESULT error codes for some common errors, for example, object not found, and object not unique. These codes are defined in file <UFT Testing Extensibility SDK installation folder>\SDK\include\TestError.h. If a method returns one of these error codes, and the GetLastError method does not provide an error message string, UFT One displays the error message defined by default for this message.

For any other error code, if the GetLastError method does not provide an error message string, UFT One displays an Unspecified Error message.