Declaration (see elgrint.cpp):
void MHandleException(int code, const MString& title, const MString& message);
Called internally to report an exception. Part of the Elgrint exceptions mechanism.
Numeric identifier of the exception (always greater than 1999).
Generated based on the code's first digit.
This function implements the final stage of exception processing, started by the GenException function. It is defined in the elgrint.cpp file, which should be added to compilation if the default implementation is sufficient. If the app contains just one file, it can be more convenient to include elgrint.cpp instead of elgrint.h (compilation configuration doesn't need to change in this case).
By default, MHandleException calls the MApp::messageBox function for all exceptions, except that 3001 and 4001 are ignored in RELEASE mode. The app windows remain enabled (disableApp parameter of MApp::messageBox is false) to avoid an "app freeze" if the exception is generated repeatedly due to an error in app design.
This behavior can be altered by defining a custom MHandleException, simply by writing a new body for it in your app. Of course, in such a case, the elgrint.cpp file cannot be included to compilation or the linking will fail due to duplicate definition.
- MHandleException should never be called explicitly
- MHandleException does not receive fatal errors (code < 2000) and assertion failure notifications. These are handled internally for safety reasons
- The custom MHandleException must be defined at global scope, in particular not inside the Elgrint namespace (see Example)
Let us know
Please Contact us to report any errors on this page, or to suggest any improvements.