Error Handling |
|
No matter how carefully crafted your code, errors can (and probably will) occur when programming against COM objects. Lack of proper documentation, misbehaved COM objects, and incorrect data types are just a few of the numerous reasons that errors will occur. When a COM error does occur, it normally appears in the form of an Error #88: Invalid/unknown property name. This error should only be taken as an indicator that a COM method (property) call failed.
To further identify the problem, the following steps should be taken:
Step |
Description |
1. |
Break multi-tick (') statement lines into single tick statements. |
2. |
Check the result of MSG(-1). |
3. |
Check the PVXERROR[$] for the object. |
4. |
Verify (with documentation or type library viewer) that the information you are passing is correct. |
In most cases, the steps above will be enough to resolve the COM errors that occur. Should this not be the case, then proper documentation will be critical in resolving the issue. If documentation is not available for the COM object, then the use of PVXDESCRIBE can be used as a last resort. This extended method takes one string parameter, which is the name of the object's property or method for which to generate information.
If the object does not expose type information, then the interop layer will not be able to provide any detailed information.