Error handling

AutoCAD Map 3D ActiveX

Error handling

The AutoCAD Map Automation API provides objects for error handling in addition to the error handling objects available through VBA. When an error occurs in the execution of an AutoCAD Map Automation API function, the API pushes errors onto the error stack. Using the ErrorStack object, you can get a diagnostic message of the error and display it for the user. To better interpret error messages or to trigger the appropriate error handler, you can determine the following types of errors by reading the ErrType property of the error in the error stack: ADE, ASE, AutoCAD, ASI, object data executable (IRD), coordinate system library (mentor), Windows application, and user-defined (DiagMessage) errors.

The DiagParam object represents user-defined error messages. By calling ErrorEntry.Add, you can add such a message to the error stack. You add your own messages to the Error Stack in conjunction with defining a failure condition for your macro.

For step-by-step information about creating an error handler, click