Error Handling

At the C++ layer, HACL uses C++ structured exception handling. In general, errors are indicated to the application by the throwing of a C++ exception with an ECLErr object. To catch errors, the application should enclose calls to the HACL objects in a try/catch block such as:
try {	
   PSObj = new ECLPS('A');	
   x = PSObj->GetSize();	
 
   //...more references to HACL objects...	
 
} catch (ECLErr ErrObj) {	
   ErrNumber = ErrObj.GetMsgNumber();	
   MessageBox(NULL, ErrObj.GetMsgText(), "ECL Error");	
}

When a HACL error is caught, the application can call methods of the ECLErr object to determine the exact cause of the error. The ECLErr object can also be called to construct a complete language-sensitive error message.

In the Automation Objects layer , runtime errors cause an appropriate scripting error to be created. An application can use an On Error handler to capture the error, query additional information about the error and take appropriate action.