Interpreting Errors

 

The PI-SDK properties and methods handle abnormal conditions by raising errors. In Visual Basic these errors should be trapped in the user's code using standard "On Error ..." statements. The Visual Basic global Err object will have the Number property set to a particular PI-SDK error or a generic automation error. The Description property of the Err object will typically contain a detailed message indicating the cause of the failure. In many cases the Description will contain a PI-SDK formatted message followed by a Server specific error message which includes the server's error number.

PI-SDK errors numbers are defined in the PISDKErrorConstants enumeration and stored in the Type library along with a string description which corresponds to the base text which will be returned in the Err.Description property. These error constants can be viewed using the Visual Basic Object Browser.

When calling PISDK methods from C or C++, errors are returned in typical COM fashion as HRESULTs.

The help file lists "Trappable Errors" in the documentation for particular methods. These are errors that might be expected when calling the specific method. Any method or property access may also raise other common errors, for example, out of memory, network connection lost, or bad argument passed. Visual Basic reports some standard errors, such as automation errors using numbers listed in the Visual Basic documentation under "Trappable Errors". The most common of these have been mapped into the PISDKErrorConstants for the user's convenience as follows:

 

PISDKErrorConstant Winerror.h constant Numeric return in Visual Basic

pseUNEXPECTED E_UNEXPECTED

0x8000FFFF

pseNOTIMPL E_NOTIMPL

0x000001BD

pseFAIL E_FAIL 

0x80004005

pseACCESSDENIED E_ACCESSDENIED

0x80070005

pseOUTOFMEMORY E_OUTOFMEMORY

0x00000007

pseINVALIDARG E_INVALIDARG

0x00000005

pseNOINTERFACE E_NOINTERFAC

0x000001AE

psePOINTER E_POINTER

0x80004003

pseHANDLE E_HANDLE

0x80070006

pseABORT E_ABORT

0x0000011F

psePENDING E_PENDING

0x8000000A

Enabling Operational Intelligence