ABL traps all COM object errors caused by property and method references. ABL formats the error information into an ABL error message that includes the hexadecimal code of the COM object error and explanatory text. If you specify the NO-ERROR option on a statement that references a COM object property or method, ABL stores the error information in the ERROR-STATUS handle, as shown:
DEFINE VARIABLE chMyObject AS COM-OBJECT NO-UNDO.
DEFINE VARIABLE ix AS INTEGER NO-UNDO.
/* ... Instantiate COM Object with chMyObject ... */
chMyObject:Method(10) NO-ERROR. IF ERROR-STATUS:NUM-MESSAGES > 0 THEN
DO ix = 1 TO ERROR-STATUS:NUM-MESSAGES:
MESSAGE ERROR-STATUS:GET-MESSAGE(ix).
END.
Note: Some types of ABL statements treat any errors as warnings even if the method or property reference results in a serious error. For warnings, ABL does not set the ERROR-STATUS:ERROR attribute. Thus, to detect that any exception (warning or error) occurred, you must check ERROR-STATUS:NUM-MESSAGES for a value greater than zero, as in the example.
You cannot otherwise access COM object error information directly unless a method includes this information in its return value or in an output parameter. This means you cannot reliably respond to a particular COM object error code. You can only tell that an error occurred and search the message text for a set of likely error codes.