Implementing the GetLastError Method: Reporting Errors

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

UFT uses HRESULT error codes for some common errors, for example, object not found, object not unique, and so forth. 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 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 displays an Unspecified Error message.