MappGetError()函数

Synopsis

Get error codes and related information.

Format

long MappGetError(ErrorType, ErrorPtr)

long ErrorType; Error type
void *ErrorPtr; Storage location for information

Description

This function obtains current or global system error codes, subcodes, messages, submessages, function codes and function names. This function allows you to check for errors after each MIL function call or to get the first error that occurred after a series of MIL function calls.

A typical use of this function is to check whether a buffer allocation call was successful (MbufAllocColor, MbufAlloc1d, and MbufAlloc2d).

This function can also be used when error-reporting to the screen has been disabled, using MappControl, and you want to obtain information about a detected error.

In multi-thread environments, an MappGetError call returns the error of the current thread or, if none, checks for errors in the other threads running MIL. To return only errors in the current thread, add M_THREAD_CURRENT to the ErrorType parameter (M_CURRENT+M_THREAD_CURRENT).

The ErrorType parameter specifies the error type. This parameter can be set to one of the following:

ErrorType Description
M_CURRENT Get the error code returned by the last command call. The system current-error code is reset to M_NULL_ERROR before each MIL function call and is set to a specific error code if an error occurs while trying to execute the function.
M_CURRENT_SUB_NB Get the number of error subcodes associated with the current error.
M_CURRENT_SUB_1…3 Get the nth error subcode returned by the last command call. Note, when there is no error, the error subcode(s) is set to M_NULL_ERROR.
M_CURRENT_FCT Get the function code associated with the current error.
M_CURRENT+M_MESSAGE Get the error message associated with the current error. The system current- error message is reset to “NULL” before each MIL function call and is set to a specific error message if an error occurs while trying to execute the function.
M_CURRENT_SUB_1…3+M_MESSAGE Get the nth error submessage associated with the current error.
M_CURRENT_FCT+M_MESSAGE Get the function name associated with the current error.
M_GLOBAL Get the error code of the first error that has occurred since the last call to MappGetError(M_GLOBAL…). The global system-error code is reset to M_NULL_ERROR after each MappGetError call with this setting.
M_GLOBAL_SUB_NB Get the number of error subcodes associated with the first error that occurred since the last call to MappGetError(M_GLOBAL…).
M_GLOBAL_SUB_1…3 Get the nth error subcode of the first error that has occurred since the call to MappGetError(M_GLOBAL…). Note, when there is no error, the error subcode(s) is set to M_NULL_ERROR.
M_GLOBAL_FCT Get the function code associated with the first error that has occurred since the last call to MappGetError(M_GLOBAL…).
M_GLOBAL+M_MESSAGE Get the error message associated with the first error that has occurred since the last call to MappGetError(M_GLOBAL…).
M_GLOBAL_SUB_1…3+M_MESSAGE Get the nth error submessage associated with the first error that has occurred since the last call to MappGetError(M_GLOBAL…).
M_GLOBAL_FCT+M_MESSAGE Get the function name associated with the first error that has occurred since the last call to MappGetError(M_GLOBAL…).

The ErrorPtr parameter specifies the address of the variable in which the requested information is to be written. If the error code is read and it is equal to M_NULL_ERROR, no error has occurred. Since the MappGetError function also returns the error code or subcode, you can set this parameter to M_NULL.

This variable should be a pointer to a long when getting error codes, subcodes, number of subcodes, and function codes. This variable should be a pointer to a string when getting messages, submessages and function names. The string must be at least M_ERROR_MESSAGE_SIZE characters in size.

Returned value

The returned value is the requested error code or subcode. When getting error messages, submessages, and function names, the returned value is the associated error code.

《MappGetError()函数》上有22条评论

评论已关闭。