Description

This event is sent after an error is detected but before the error is logged or a message box is shown

Syntax

Private Sub object_AfterError(Flags, LocalizedDesc, ErrorCode, Module, Source, HelpContextID, HelpFile)

The AfterError Event syntax has these parts:

PartDescription
objectA McApplication object.
FlagsA mcShowErrorFlags enumeration, as described in settings.

mcShowErrorFlags* : This is an [in,out] parameter. Before the event is fired, it will have two flags set in it to indicate whether the error message box will be shown (either mcsefForceDisplayOn or mcsefForceDisplayOff will be set) and what degree of severity is assigned to the error (either mcsefForceWarning, mcsefForceError or mcsefForceIgnore will be set). The event sink may leave these alone, or it may assign different values from the two sets of flags. If there are multiple event sinks, then the last one to assign to Flags will control the behavior.

LocalizedDescA String value.

BSTR : The description that will be displayed in the error message box and in the EventLog. This description will have already been localized.

ErrorCodeA Long value.

long : The error code supplied to ShowError.

ModuleA String value.

BSTR : The module that generated the error as supplied to ShowError.

SourceA String value.

BSTR : The source of the error. This will usually not be the Module, but instead it will be the ProgID of a lower level operator (e.g., something like “McOpLib.McGeometry”).

HelpContextIDA Long value.

long : The localized HelpContextID.

HelpFileA String value.

BSTR : The help file name.

Settings

The settings for Flags are:

ConstantValueDescription
 mcsefNoFlags0

This is the default behavior. The OverallDescription is localized using the Module argument, and any ErrorInfo Descripition is not localized. The ErrorInfo Help Context ID is localized using the Module.

 mcsefDoNotLocalizeOverall1

If set, do not localize the OverallDescription passed to ShowError before display. If the OverallDescripion is localized, the Module argument is used.

 mcsefLocalizeErrorInfo2

If set, Localize the Description in the ErrorInfo argument before display. The ErrorInfo Source property up to any period is used as the module for the localization unless the mcsefUseModuleForLocalize flag is set.

 mcsefDoNotLocalizeHelpContext4

If set, do not Localize the Help Context ID in the ErrorInfo argument before display. Note that the Help Context ID is always localized using the Module argument.

 mcsefUseModuleForLocalize8

If set when localizing the ErrorInfo Description property, then the Module argument is used for the Localized call's module. If not set, the Source property (up to any period) in the ErrorInfo argument is used as the Localized module for this description. The Help Context ID is always localized using the Module argument.

 mcsefForceDisplayOn16

If set then display of the message box is forced on, irrespect of the user's preference setting. One of the AfterError event sinks can still override this. If both mcsefForceDisplayOn and mcsefForceDisplayOff are set, then mcsefForceDisplayOn takes precedence.

 mcsefForceDisplayOff32

If set then display of the message box is forced off, irrespect of the user's preference setting. One of the AfterError event sinks can still override this. If both mcsefForceDisplayOn and mcsefForceDisplayOff are set, then mcsefForceDisplayOn takes precedence.

 mcsefForceWarning256

If set then the error is treated as a warning, irrespective of its ErrorCode's category bits. Normally an ErrorCode with the mceErrCatInterrupted is ignored, and ones with any of the other mceErrCat... category bits set are treated as warnings. Use this bit to force treatment as a warning.

 mcsefForceError512

If set then the error is treated as a severe error and not a warning, irrespective of its ErrorCode's category bits. Normally an ErrorCode with the mceErrCatInterrupted is ignored, and ones with any of the other mceErrCat... category bits set are treated as warnings. Use this bit to force treatment as an error.

 mcsefForceIgnore1024

If set then the error is ignored, irrespective of its ErrorCode's category bits. Normally only an ErrorCode with the mceErrCatInterrupted is ignored, and ones with any of the other mceErrCat... category bits set are treated as warnings. The caller or AfterError event sink routine can use this bit to cause the error to be ignored.

Remarks

The event sink can examine the error and determine if the default error display is appropriate. If the event sink wishes to change the way that the error is displayed, then it may assign to the Flags parameter to change the display behavior. For example, if the event sink wishes to do its own error display, then it should assign mcsefForceDisplayOff to the Flags.

The AfterError event is fired by the McApplication.ShowError method.