目录

aip_error_code.h

Overview

Provides APIs related to error codes.

File to include: #include "dataaugmentation/aip_error_code.h"

Library: libretrieval_ndk.so

System capability: SystemCapability.DataAugmentation.Retrieval

Since: 6.0.0(20)

Related module: AIP

Summary

[h2]Types

Name Description
typedef enum OH_Aip_ErrCode OH_Aip_ErrCode Enumerates the error codes.

[h2]Enums

Name Description

OH_Aip_ErrCode {

AIP_OK = 0,

AIP_E_EXEC_ERR = 1021200005,

AIP_E_OUT_OF_RANGE = 1021200006,

AIP_E_NO_SUCH_FIELD = 1021200007,

AIP_E_OVER_LIMIT = 1021200008,

AIP_E_CONDITION_OVER_LIMIT = 1021200009,

AIP_E_INVALID_ARGS = 1021200010,

AIP_E_EMBEDDING_ERR = 1021200012

}

Enumerates the error codes. The meanings of the error codes are as follows:

- AIP_OK: The operation is successful.

- AIP_E_EXEC_ERR: An error occurs during execution, which may be caused by an internal running exception.

- AIP_E_OUT_OF_RANGE: The input parameter is out of the allowed range. For example, the index is out of range.

- AIP_E_NO_SUCH_FIELD: The requested field does not exist. The specified field name is not found in the current record.

- AIP_E_OVER_LIMIT: The array exceeds the maximum length limit (512 bytes).

- AIP_E_CONDITION_OVER_LIMIT: The number of retrieval conditions exceeds the upper limit (1).

- AIP_E_INVALID_ARGS: The input parameter is invalid. For example, the pointer is null or the parameter type does not match.

- AIP_E_EMBEDDING_ERR: The embedding vector cannot be generated. The possible cause is that the model fails to be loaded or the input content does not support vectorization.

// Example: Process the result code of the AIP API.
int ret = OH_Retrieval_Retrieve(retriever, query, condition, NULL, &record);
if (ret != AIP_OK) {
    switch (ret) {
        case AIP_E_INVALID_ARGS:
            printf("Invalid parameter. Check the input parameter.\n");
            break;
        case AIP_E_OUT_OF_RANGE:
            printf("The parameter is out of range. Check the index value.\n");
            break;
        case AIP_E_EMBEDDING_ERR:
            printf("Failed to generate the embedding vector. Check whether the model is properly loaded.\n");
            break;
        default:
            printf("Operation failed. Error code: %d\n", ret);
            break;
    }
}