Function _get_extended_error_information
Get Extended Error Information Function
Get Extended Error related information
Print Extended Error Information is a sample function which returns an associated more explanatory constant string that explains a return error.
const wchar_t* _get_extended_error_information(const int32_t _res)
{
switch (_res)
{
case _LZNV_NO_ERROR_:
return L"No Errors!";
break;
case _LZNV_ERROR_INVALID_COMPRESSION_METHOD:
return L" Invalid Compression Method. Please check parameter _encoding_method!";
break;
case _LZNV_ERROR_INVALID_BUFFER_SIZE:
return L" Invalid Buffer Size. Please check parameter _memory_level!";
break;
case _LZNV_ERROR_EXPORTED_MAIN_FUNC_NOT_FOUND:
return L" Export DLL Function Not Found. Corrupted DLL?";
break;
case _LZNV_ERROR_UNKNOWN_COMMAND_TO_EXECUTE:
return L" Invalid Command to execute!";
break;
case _LZNV_ERROR_NOT_ENOUGH_OUTPUT_SPACE:
return L" Not Enough Output space for compressed data. Please check parameter _i_destination_buffer_size!";
break;
case _LZNV_ERROR_BAD_HEADER_INFO_RECORDED:
return L" Invalid Header info read!";
break;
case _LZNV_ERROR_INVALID_FILE_PATH_PARAMS:
return L" Invalid input file path. Please check parameter _source_file_path.";
break;
case _LZNV_ERROR_INVALID_INPUT_FILE:
return L" Invalid input file handle. Please check parameter _source_file_path.";
break;
case _LZNV_ERROR_INVALID_INPUT_FILE_SIZE:
return L" Invalid input file size. Please check parameter _source_file_path.";
break;
case _LZNV_ERROR_INVALID_OUTPUT_FILE:
return L" Invalid output file handle. Please check parameter _target_file_path.";
break;
case _LZNV_ERROR_WRITING_HEADER:
return L" Invalid header write operation.";
break;
case _LZNV_ERROR_MEMORY_ALLOCATION_ERROR_OR_SIZE:
return L" Invalid allocated memory block returned. Out of memory?";
break;
case _LZNV_ERROR_BAD_HEADER_INFO:
return L" Invalid header read operation.";
break;
case _LZNV_ERROR_INVALID_READ:
return L" Invalid read from file.";
break;
case _LZNV_ERROR_INVALID_PROCESS_SIZE:
return L" Invalid processing size. Corrupted compressed data?";
break;
}
return L"UNKNOWN ERROR CODE!";
}
Usage:
int32_t _res = 0; // NO_ERROR
_res = (*_p_LZNV_DLL_Main_Buffer_funct)(_lznv_buffer_compression_command);
// or
_res = (*_p_LZNV_DLL_Main_File_funct)(_lznv_file_command);
if(NO_ERROR != _res)
{
const wchar_t* _wch_error_string = _print_extended_error_information(_res);
wprintf(L"-> Error Detected: %s", _wch_error_string);
}
// or
if (NO_ERROR != _res)
{
wprintf(L"-> Error Detected: %s", _get_extended_error_information(_res));
}