GetErrorDescription
Description
GetErrorDescription returns the description of an error identified by its identification number.
Syntax
int GetErrorDescription(const int inError, const wchar_t*& owszDescription);
Parameters
Input
inError: the identification number of the error returned in the description. The identification number is different from 0 and is returned when an error occurs in a function.
Output
owszDescription: the description of the error identified by the identification number inError.
Return
(int): returns the identification number of the error if an error occurs or 0 if no error occurs.
Example
To get a full example of the API use, download the .Plugin
#define OPT_PLUGIN_NO_ERROR 0
#define OPT_PLUGIN_ERROR_UNKNOWN_ERROR 1
#define OPT_PLUGIN_ERROR_NO_TEST 2
#define OPT_PLUGIN_ERROR_UNKNOWN_TEST 3
#define OPT_PLUGIN_ERROR_INVALID_DATA 4
#define OPT_PLUGIN_ERROR_UNKNOWN_SECTION 5
std::map<int, std::wstring> gmErrorDescription;
gmErrorDescription[OPT_PLUGIN_ERROR_UNKNOWN_ERROR] = L"PLUGIN ERROR : Unknown error";
gmErrorDescription[OPT_PLUGIN_ERROR_NO_TEST] = L"PLUGIN ERROR : No test defined";
gmErrorDescription[OPT_PLUGIN_ERROR_UNKNOWN_TEST] = L"PLUGIN ERROR : Test index out of bounds";
gmErrorDescription[OPT_PLUGIN_ERROR_INVALID_DATA] = L"PLUGIN ERROR : Empty or null data";
gmErrorDescription[OPT_PLUGIN_ERROR_UNKNOWN_SECTION] = L"PLUGIN ERROR : Section index out of bounds";
int GetErrorDescription(const int inError, const wchar_t*& owszDescription)
{
if (inError >= 0 && inError < (int)gmErrorDescription.size())
{
owszDescription = gmErrorDescription[inError].c_str();
}
else
{
owszDescription = gmErrorDescription[OPT_PLUGIN_ERROR_UNKNOWN_ERROR].c_str();
return OPT_PLUGIN_ERROR_UNKNOWN_ERROR;
}
return OPT_PLUGIN_NO_ERROR;
}