Updated on 2024-07-30 GMT+08:00

Obtaining an Error Message

GetErrorMessage

API Description

This API is used to obtain an error message.

Precautions

  1. This API is a synchronous API. The return value only indicates whether the API is successfully called.

Method Definition

1
HWM_SDK_AGENT_API hwmsdk::HwmErrCode GetErrorMessage(int errorCode, OUT HwmErrorMessageInfo *errorMessageInfo);

Parameter Description

Table 1 Parameter description

Parameter

Type

Description

errorCode

int

Error code.

Table 2 HwmErrorMessageInfo description

Parameter

Type

Description

errorMessage

char[]

Error message. UTF-8 encoding is required.

Table 3 Return values

Type

Description

HwmErrCode

If 0 is returned, the operation is successful. If other values are returned, the operation fails. For details about values returned upon failures, see Common Error Codes.

HwmErrorMessageInfo

Error message.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/**
* Obtain an error message.
*/
void demoGetErrorMessageDlg::OnBnClickedOk()
{
    hwmsdkagent::HwmErrorMessageInfo info{};
    int ret = hwmsdkagent::GetErrorMessage(hwmsdk::HWM_AGENT_ERR_IN_PROCESS, &info);
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("get error message error"));
        return;
    }
}