Class Hierarchy
AcHeapOperators AcRxObject AcPlObject AcPlPlotErrorHandler AcPlPlotLoggingErrorHandler
C++
class AcPlPlotErrorHandler : public AcPlObject;
File
AcPlPlotErrorHandler.h
Description
This interface class exposes error-handling capabilities to client applications. The host application provides a stock error handler that is always present and is used by the hardcopy subsystem if no application error handler is provided. Applications can derive from this class to handle errors fired by the plotting subsystem. Any error not handled is passed up the error handler chain until it is handled.
The AutoCAD hardcopy subsystem uses a chain of error handlers derived from a common class. The AutoCAD application error handler is at the end of this chain. It handles errors that can cause AutoCAD to terminate, so that the user's drawing(s) can be saved as AutoCAD is shutting down. The AutoCAD error handler also owns the main hardcopy log file.
In addition to handling errors and managing the error log file, the AutoCAD error handler provides a few services for lower-level clients.
All hardcopy components have an error handler that is connected to this chain of error handlers. Hardcopy errors in a component are handled by making calls to this error handler. Lower-level error handlers can choose to handle errors locally, or they can delegate errors to their parent (except for the handler at the end of the chain, which must handle all errors).
An error handler can be placed in "quiet mode," in which case it does not display messages in the user interface. Errors and warnings are directed to the log file instead. This mode is essential for the proper operation of scripts, batch plotting, and background plotting. Otherwise, when AutoCAD is operating in interactive mode, the error handler displays a dialog box when handling an error or warning.
Low-level hardcopy components can throw exceptions derived from HT_Exception. Higher-level hardcopy components should not throw exceptions and should catch and handle any exceptions thrown by the low-level components. Typically, when an exception is caught, it is given to the error handler.
Different components can have different resource files for localized strings. When an exception is thrown or a call is made to the error handler, it is likely to be handled at a different level of the subsystem, where a different resource file may be in use. For this reason, hardcopy exceptions and calls to the error handler usually are made with an idiom that includes passing the handle for the resource file containing the localized error message, and a resource ID identifying the particular string to be used. Additional non-localized strings are provided to supplement the specific error string. For example:
AcPlPlotErrorHandler::warning( unsigned long category, // resource handle const unsigned int specific, // resource ID const char *location, const char * contextData, const char * revision);
category The current error handler has a default codeless resource used to load resource strings if the first parameter to an error handler function is null; otherwise, the parameter is used as a module handle to load resource strings |
specific Defines the error that occurred: a string ID (in the specified module) for the localized message the user should see |
location The class and member function that generated the error; typically, the member function that first threw the error, if exceptions are being used; in the future, a mechanism will be created to concatenate the location of each function in the call stack from the "throw" to the "catch," and call the error handler, thus storing the call stack in the location |
contextData Additional runtime information: may be a file name, port name, or other helpful information; contextData is expected to be a mutibyte string to support globalization |
revision File revision information: Autodesk uses a revision control system to keep file name and version strings up to date in the source files, to better identify when a file was compiled, and to simplify determining the cause of exceptions |
location, contextData, and revision are debug-only information. Their fields are suppressed in production builds.
Links
AcPlPlotErrorHandler Enumerations, AcPlPlotErrorHandler Methods