GetErrorDescription


The GetErrorDescription method retrieves textual information describing error of last operation.
C++
long GetErrorDescription(
  LPSTR Description,                 // buffer that receives error description
  long DescriptionLength             // size of buffer
);
long GetErrorDescription(
  LWPSTR Description,                // buffer that receives error description
  long DescriptionLength             // size of buffer
);
BASIC
GetErrorDescription() As String

Parameters

C++
Description
Pointer to buffer that receives error description.
Buffer must be large enough to accept at most DescriptionLength + 1 characters.
DescriptionLength
Size of buffer; if error description is longer, it is truncated to DescriptionLength characters.

Return Values

C++
If the method succeeds, the return value is the number of characters returned to the user, not including terminating NULL.
If the method fails, the return value is IXF_FAILURE_INTERNAL.
BASIC
If the method succeeds, the return value is a String containing error description.
If the method fails, the return value is NULL.

Remarks

Method is used to obtain error message text for the error code of last operation. Message is formatted by the system according to current locale settings. If you need to format message in different language you can use system function FormatMessage passing error code retrieved with GetError as a parameter.

Most IXFile methods set error and failure codes on completion regardless of result; if operation failed codes are set to their appropriate values; if operation succeeded error and failure codes are both set to 0. For this reason you should retrieve error description immediately when method returns to avoid wiping it out by another call.

Unicode version of the method should not be confused with Unicode system calls - all versions of the method can be used on Unicode and non-Unicode systems depending on your needs. On Unicode systems, however, error description is retrieved by Unicode version of system function (unless Unicode is disabled with EnableUnicode method). See Unicode Support for more information on Unicode system calls, Unicode methods and Unicode text data.

See Also

GetError, GetFailure, ClearError, Error Handling