Progress
External Program
Interfaces


Error Handling

Progress traps all COM object errors caused by property and method references. Progress formats the error information into a Progress 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, Progress stores the error information in the ERROR-STATUS handle:

DEFINE VARIABLE chMyObject AS COM-OBJECT.
DEFINE VARIABLE i AS INTEGER.

/* ... Instantiate COM Object with chMyObject ... */

chMyObject:Method(10) NO-ERROR.
IF ERROR-STATUS:NUM-MESSAGES > 0 THEN
   DO i = 1 TO ERROR-STATUS:NUM-MESSAGES:
      MESSAGE ERROR-STATUS:GET-MESSAGE(i).
   END. 

NOTE: Some types of Progress statements treat any errors as warnings even if the method or property reference results in a serious error. For warnings, Progress 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.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095