MfuncErrorReport()函数

Synopsis

Report an error message.

Format

long MfuncErrorReport(FunctionId, ErrorCode, ErrorMessage, ErrorSubMessage1, ErrorSubMessage2, ErrorSubMessage3)

MIL_ID FunctionId; Function identifier
long ErrorCode; Error code to log
char *ErrorMessage; Error message to log
char *ErrorSubMessage1; Sub-error message 1 to log
char *ErrorSubMessage2; Sub-error message 2 to log
char *ErrorSubMessage3; Sub-error message 3 to log

Description

This function allows you to log an error message using the MIL error handling mechanism. When this function is called, MIL will treat your error as a normal MIL error. If error reporting is enabled, the error message will be printed and all the information will be logged by the MIL error handler. These errors can be read using the standard MIL error functions (MappGetError).

If you report an error with an error code set to M_NULL, you will reset any pending internal error that a MIL function call, inside your pseudo-MIL function, might have generated. This is useful if you don’t wish the MIL error message to be reported. If you don’t clear these errors, or you don’t report your own error, MIL will detect any pending error when executing MfuncFreeAndEnd and report the error message, prefixed with the name of your pseudo-MIL function.

The FunctionId parameter is the MIL identifier of the pseudo-MIL function in use.

The ErrorCode parameter is the numeric code assigned to the pseudo-MIL function’s group of error messages. It must be M_FUNC_ERROR or greater (M_FUNC_ERROR+offset), so that it does not conflict with MIL specific errors.

The ErrorMessage parameter and its sub-messages are null terminated strings specifying the text of your error message. If you do not want to use one of the sub-messages, M_NULL can be passed. The error message, or any sub-error message, must not be longer than M_ERROR_MESSAGE_SIZE characters (including the terminating null character).

Returned value

The returned value is M_NULL if an error occurred during the error log operation; otherwise, not null.