The PI-SDK provides detailed error information when problems are encountered. Being an ActiveX library, the PI-SDK follows the COM convention for returning errors. Detection of COM errors is programming language dependent. In addition, using certain frameworks, template libraries or wrapper classes may change the way in which errors are detected. This section covers some standard cases for Visual Basic and Visual C++. For more detail and information on error handling in other languages consult the specific language or library documentation.
The PI-SDK returns errors from a defined set of HRESULTs, which C and C++ users receive from a method call. The PI-SDK objects also support extended error information, so when an error is detected more detailed information can be retrieved through the IErrorInfo interface. PI-SDK errors are also defined as an enumeration, PISDKErrorConstants, in the type library so browsers can see all possible PI-SDK errors along with a descriptive string. A runtime function is also provided that converts the enumerated constant to its descriptive string. During execution, when an error is detected the detailed error information will contain this description. In addition, if an error results from a lower level call, such as a PI RPC call or a Win32 call, information from that related error would be prefixed to the error description string.