modify error msg for asset

Signed-off-by: 尹耀德 <yinyaode1@huawei.com>
This commit is contained in:
尹耀德 2024-05-15 16:44:57 +08:00
parent 05746a43b7
commit 907f1901a9
2 changed files with 102 additions and 142 deletions

View File

@ -52,23 +52,23 @@ extern "C" {
*
* @param attributes Pointer to the attributes of the asset to add.
* @param attributes Number of the attributes of the asset to add.
* @return Returns <b>ASSET_SUCCESS</b> if the operation is successful;
* Returns <b>ASSET_PERMISSION_DENIED</b> if the caller doesn't have the permission;
* Returns <b>ASSET_INVALID_ARGUMENT</b> if mandatory parameters are left unspecified or
* if incorrect parameter types, or if parameter verification failed;
* Returns <b>ASSET_SERVICE_UNAVAILABLE</b> if the ASSET service is unavailable;
* Returns <b>ASSET_DUPLICATED</b> if the asset already exists;
* Returns <b>ASSET_STATUS_MISMATCH</b> if the screen lock status does not match;
* Returns <b>ASSET_OUT_OF_MEMORY</b> if insufficient memory;
* Returns <b>ASSET_DATA_CORRUPTED</b> if the asset is corrupted;
* Returns <b>ASSET_DATABASE_ERROR</b> if the database operation failed;
* Returns <b>ASSET_CRYPTO_ERROR</b> if the cryptography operation failed;
* Returns <b>ASSET_IPC_ERROR</b> if IPC failed;
* Returns <b>ASSET_BMS_ERROR</b> if calling the Bundle Manager service failed;
* Returns <b>ASSET_ACCOUNT_ERROR</b> if calling the OS Account service failed;
* Returns <b>ASSET_ACCESS_TOKEN_ERROR</b> if calling the Access Token service failed;
* Returns <b>ASSET_FILE_OPERATION_ERROR</b> if the file operation failed;
* Returns <b>ASSET_GET_SYSTEM_TIME_ERROR</b> if getting the system time failed.
* @return {@link ASSET_SUCCESS} 0 - The operation is successful;
* {@link ASSET_PERMISSION_DENIED} 201 - The caller doesn't have the permission;
* {@link ASSET_INVALID_ARGUMENT} 401 - Mandatory parameters are left unspecified or
* incorrect parameter types, or parameter verification failed;
* {@link ASSET_SERVICE_UNAVAILABLE} 24000001 - The ASSET service is unavailable;
* {@link ASSET_DUPLICATED} 24000003 - The asset already exists;
* {@link ASSET_STATUS_MISMATCH} 24000005 - The screen lock status does not match;
* {@link ASSET_OUT_OF_MEMORY} 24000006 - Insufficient memory;
* {@link ASSET_DATA_CORRUPTED} 24000007 - The asset is corrupted;
* {@link ASSET_DATABASE_ERROR} 24000008 - The database operation failed;
* {@link ASSET_CRYPTO_ERROR} 24000009 - The cryptography operation failed;
* {@link ASSET_IPC_ERROR} 24000010 - IPC failed;
* {@link ASSET_BMS_ERROR} 24000011 - Calling the Bundle Manager service failed;
* {@link ASSET_ACCOUNT_ERROR} 24000012 - Calling the OS Account service failed;
* {@link ASSET_ACCESS_TOKEN_ERROR} 24000013 - Calling the Access Token service failed;
* {@link ASSET_FILE_OPERATION_ERROR} 24000014 - The file operation failed;
* {@link ASSET_GET_SYSTEM_TIME_ERROR} 24000015 - Getting the system time failed.
* @since 11
*/
int32_t OH_Asset_Add(const Asset_Attr *attributes, uint32_t attrCnt);
@ -78,17 +78,17 @@ int32_t OH_Asset_Add(const Asset_Attr *attributes, uint32_t attrCnt);
*
* @param query Pointer to the conditions for removing the assets.
* @param queryCnt Number of conditions for removing the assets.
* @return Returns <b>ASSET_SUCCESS</b> if the operation is successful;
* Returns <b>ASSET_INVALID_ARGUMENT</b> if incorrect parameter types, or if parameter verification failed;
* Returns <b>ASSET_SERVICE_UNAVAILABLE</b> if the ASSET service is unavailable;
* Returns <b>ASSET_NOT_FOUND</b> if the asset is not found;
* Returns <b>ASSET_OUT_OF_MEMORY</b> if insufficient memory;
* Returns <b>ASSET_DATA_CORRUPTED</b> if the asset is corrupted;
* Returns <b>ASSET_DATABASE_ERROR</b> if the database operation failed;
* Returns <b>ASSET_IPC_ERROR</b> if IPC failed;
* Returns <b>ASSET_BMS_ERROR</b> if calling the Bundle Manager service failed;
* Returns <b>ASSET_ACCOUNT_ERROR</b> if calling the OS Account service failed;
* Returns <b>ASSET_ACCESS_TOKEN_ERROR</b> if calling the Access Token service failed.
* @return {@link ASSET_SUCCESS} 0 - The operation is successful;
* {@link ASSET_INVALID_ARGUMENT} 401 - Incorrect parameter types, or parameter verification failed;
* {@link ASSET_SERVICE_UNAVAILABLE} 24000001 - The ASSET service is unavailable;
* {@link ASSET_NOT_FOUND} 24000002 - The asset is not found;
* {@link ASSET_OUT_OF_MEMORY} 24000006 - Insufficient memory;
* {@link ASSET_DATA_CORRUPTED} 24000007 - The asset is corrupted;
* {@link ASSET_DATABASE_ERROR} 24000008 - The database operation failed;
* {@link ASSET_IPC_ERROR} 24000010 - IPC failed;
* {@link ASSET_BMS_ERROR} 24000011 - Calling the Bundle Manager service failed;
* {@link ASSET_ACCOUNT_ERROR} 24000012 - Calling the OS Account service failed;
* {@link ASSET_ACCESS_TOKEN_ERROR} 24000013 - Calling the Access Token service failed.
* @since 11
*/
int32_t OH_Asset_Remove(const Asset_Attr *query, uint32_t queryCnt);
@ -100,21 +100,21 @@ int32_t OH_Asset_Remove(const Asset_Attr *query, uint32_t queryCnt);
* @param queryCnt Number of conditions for updating the asset.
* @param attributes Pointer to the attributes of the asset to update.
* @param attributes Number of the attributes of the asset to update.
* @return Returns <b>ASSET_SUCCESS</b> if the operation is successful;
* Returns <b>ASSET_INVALID_ARGUMENT</b> if mandatory parameters are left unspecified or
* if incorrect parameter types, or if parameter verification failed;
* Returns <b>ASSET_SERVICE_UNAVAILABLE</b> if the ASSET service is unavailable;
* Returns <b>ASSET_NOT_FOUND</b> if the asset is not found;
* Returns <b>ASSET_STATUS_MISMATCH</b> if the screen lock status does not match;
* Returns <b>ASSET_OUT_OF_MEMORY</b> if insufficient memory;
* Returns <b>ASSET_DATA_CORRUPTED</b> if the asset is corrupted;
* Returns <b>ASSET_DATABASE_ERROR</b> if the database operation failed;
* Returns <b>ASSET_CRYPTO_ERROR</b> if the cryptography operation failed;
* Returns <b>ASSET_IPC_ERROR</b> if IPC failed;
* Returns <b>ASSET_BMS_ERROR</b> if calling the Bundle Manager service failed;
* Returns <b>ASSET_ACCOUNT_ERROR</b> if calling the OS Account service failed;
* Returns <b>ASSET_ACCESS_TOKEN_ERROR</b> if calling the Access Token service failed;
* Returns <b>ASSET_GET_SYSTEM_TIME_ERROR</b> if getting the system time failed.
* @return {@link ASSET_SUCCESS} 0 - The operation is successful;
* {@link ASSET_INVALID_ARGUMENT} 401 - Mandatory parameters are left unspecified or
* incorrect parameter types, or parameter verification failed;
* {@link ASSET_SERVICE_UNAVAILABLE} 24000001 - The ASSET service is unavailable;
* {@link ASSET_NOT_FOUND} 24000002 - The asset is not found;
* {@link ASSET_STATUS_MISMATCH} 24000005 - The screen lock status does not match;
* {@link ASSET_OUT_OF_MEMORY} 24000006 - Insufficient memory;
* {@link ASSET_DATA_CORRUPTED} 24000007 - The asset is corrupted;
* {@link ASSET_DATABASE_ERROR} 24000008 - The database operation failed;
* {@link ASSET_CRYPTO_ERROR} 24000009 - The cryptography operation failed;
* {@link ASSET_IPC_ERROR} 24000010 - IPC failed;
* {@link ASSET_BMS_ERROR} 24000011 - Calling the Bundle Manager service failed;
* {@link ASSET_ACCOUNT_ERROR} 24000012 - Calling the OS Account service failed;
* {@link ASSET_ACCESS_TOKEN_ERROR} 24000013 - Calling the Access Token service failed;
* {@link ASSET_GET_SYSTEM_TIME_ERROR} 24000015 - Getting the system time failed.
* @since 11
*/
int32_t OH_Asset_Update(const Asset_Attr *query, uint32_t queryCnt,
@ -126,21 +126,21 @@ int32_t OH_Asset_Update(const Asset_Attr *query, uint32_t queryCnt,
* @param query Pointer to the search criteria of the asset.
* @param queryCnt Number of the search criteria.
* @param challenge Pointer to the challenge value to be used when <b>OH_Asset_Query</b> is called.
* @return Returns <b>ASSET_SUCCESS</b> if the operation is successful;
* Returns <b>ASSET_INVALID_ARGUMENT</b> if incorrect parameter types, or if parameter verification failed;
* Returns <b>ASSET_SERVICE_UNAVAILABLE</b> if the ASSET service is unavailable;
* Returns <b>ASSET_NOT_FOUND</b> if the asset is not found;
* Returns <b>ASSET_STATUS_MISMATCH</b> if the screen lock status does not match;
* Returns <b>ASSET_OUT_OF_MEMORY</b> if insufficient memory;
* Returns <b>ASSET_DATA_CORRUPTED</b> if the asset is corrupted;
* Returns <b>ASSET_DATABASE_ERROR</b> if the database operation failed;
* Returns <b>ASSET_CRYPTO_ERROR</b> if the cryptography operation failed;
* Returns <b>ASSET_IPC_ERROR</b> if IPC failed;
* Returns <b>ASSET_BMS_ERROR</b> if calling the Bundle Manager service failed;
* Returns <b>ASSET_ACCOUNT_ERROR</b> if calling the OS Account service failed;
* Returns <b>ASSET_ACCESS_TOKEN_ERROR</b> if calling the Access Token service failed;
* Returns <b>ASSET_LIMIT_EXCEEDED</b> if the cache exceeds the limit;
* Returns <b>ASSET_UNSUPPORTED</b> if the capability is not supported.
* @return {@link ASSET_SUCCESS} 0 - The operation is successful;
* {@link ASSET_INVALID_ARGUMENT} 401 -Incorrect parameter types, or parameter verification failed;
* {@link ASSET_SERVICE_UNAVAILABLE} 24000001 - The ASSET service is unavailable;
* {@link ASSET_NOT_FOUND} 24000002 - The asset is not found;
* {@link ASSET_STATUS_MISMATCH} 24000005 - The screen lock status does not match;
* {@link ASSET_OUT_OF_MEMORY} 24000006 - Insufficient memory;
* {@link ASSET_DATA_CORRUPTED} 24000007 - The asset is corrupted;
* {@link ASSET_DATABASE_ERROR} 24000008 - The database operation failed;
* {@link ASSET_CRYPTO_ERROR} 24000009 - The cryptography operation failed;
* {@link ASSET_IPC_ERROR} 24000010 - IPC failed;
* {@link ASSET_BMS_ERROR} 24000011 - Calling the Bundle Manager service failed;
* {@link ASSET_ACCOUNT_ERROR} 24000012 - Calling the OS Account service failed;
* {@link ASSET_ACCESS_TOKEN_ERROR} 24000013 - Calling the Access Token service failed;
* {@link ASSET_LIMIT_EXCEEDED} 24000016 - The cache exceeds the limit;
* {@link ASSET_UNSUPPORTED} 24000017 - The capability is not supported.
* @since 11
*/
int32_t OH_Asset_PreQuery(const Asset_Attr *query, uint32_t queryCnt, Asset_Blob *challenge);
@ -151,21 +151,21 @@ int32_t OH_Asset_PreQuery(const Asset_Attr *query, uint32_t queryCnt, Asset_Blob
* @param query Pointer to the search criteria.
* @param queryCnt Number of the search criteria.
* @param resultSet Pointer to the query result obtained.
* @return Returns <b>ASSET_SUCCESS</b> if the operation is successful;
* Returns <b>ASSET_INVALID_ARGUMENT</b> if incorrect parameter types, or if parameter verification failed;
* Returns <b>ASSET_SERVICE_UNAVAILABLE</b> if the ASSET service is unavailable;
* Returns <b>ASSET_NOT_FOUND</b> if the asset is not found;
* Returns <b>ASSET_ACCESS_DENIED</b> if access to the asset is denied;
* Returns <b>ASSET_STATUS_MISMATCH</b> if the screen lock status does not match;
* Returns <b>ASSET_OUT_OF_MEMORY</b> if insufficient memory;
* Returns <b>ASSET_DATA_CORRUPTED</b> if the asset is corrupted;
* Returns <b>ASSET_DATABASE_ERROR</b> if the database operation failed;
* Returns <b>ASSET_CRYPTO_ERROR</b> if the cryptography operation failed;
* Returns <b>ASSET_IPC_ERROR</b> if IPC failed;
* Returns <b>ASSET_BMS_ERROR</b> if calling the Bundle Manager service failed;
* Returns <b>ASSET_ACCOUNT_ERROR</b> if calling the OS Account service failed;
* Returns <b>ASSET_ACCESS_TOKEN_ERROR</b> if calling the Access Token service failed;
* Returns <b>ASSET_UNSUPPORTED</b> if the capability is not supported.
* @return {@link ASSET_SUCCESS} 0 - The operation is successful;
* {@link ASSET_INVALID_ARGUMENT} 401 - Incorrect parameter types, or parameter verification failed;
* {@link ASSET_SERVICE_UNAVAILABLE} 24000001 - The ASSET service is unavailable;
* {@link ASSET_NOT_FOUND} 24000002 - The asset is not found;
* {@link ASSET_ACCESS_DENIED} 24000004 - Access to the asset is denied;
* {@link ASSET_STATUS_MISMATCH} 24000005 - The screen lock status does not match;
* {@link ASSET_OUT_OF_MEMORY} 24000006 - Insufficient memory;
* {@link ASSET_DATA_CORRUPTED} 24000007 - The asset is corrupted;
* {@link ASSET_DATABASE_ERROR} 24000008 - The database operation failed;
* {@link ASSET_CRYPTO_ERROR} 24000009 - The cryptography operation failed;
* {@link ASSET_IPC_ERROR} 24000010 - IPC failed;
* {@link ASSET_BMS_ERROR} 24000011 - Calling the Bundle Manager service failed;
* {@link ASSET_ACCOUNT_ERROR} 24000012 - Calling the OS Account service failed;
* {@link ASSET_ACCESS_TOKEN_ERROR} 24000013 - Calling the Access Token service failed;
* {@link ASSET_UNSUPPORTED} 24000017 - The capability is not supported.
* @since 11
*/
int32_t OH_Asset_Query(const Asset_Attr *query, uint32_t queryCnt, Asset_ResultSet *resultSet);
@ -176,15 +176,15 @@ int32_t OH_Asset_Query(const Asset_Attr *query, uint32_t queryCnt, Asset_ResultS
* @param handle Pointer to the handle of the data to process, which includes the challenge value returned by
* <b>OH_Asset_PreQuery</b>.
* @param handleCnt Number of the elements in the handle attribute set.
* @return Returns <b>ASSET_SUCCESS</b> if the operation is successful;
* Returns <b>ASSET_INVALID_ARGUMENT</b> if mandatory parameters are left unspecified or
* if incorrect parameter types, or if parameter verification failed;
* Returns <b>ASSET_SERVICE_UNAVAILABLE</b> if the ASSET service is unavailable;
* Returns <b>ASSET_OUT_OF_MEMORY</b> if insufficient memory;
* Returns <b>ASSET_IPC_ERROR</b> if IPC failed;
* Returns <b>ASSET_BMS_ERROR</b> if calling the Bundle Manager service failed;
* Returns <b>ASSET_ACCOUNT_ERROR</b> if calling the OS Account service failed;
* Returns <b>ASSET_ACCESS_TOKEN_ERROR</b> if calling the Access Token service failed.
* @return {@link ASSET_SUCCESS} 0 - The operation is successful;
* {@link ASSET_INVALID_ARGUMENT} 401 - Mandatory parameters are left unspecified or
* incorrect parameter types, or parameter verification failed;
* {@link ASSET_SERVICE_UNAVAILABLE} 24000001 - The ASSET service is unavailable;
* {@link ASSET_OUT_OF_MEMORY} 24000006 - Insufficient memory;
* {@link ASSET_IPC_ERROR} 24000010 - IPC failed;
* {@link ASSET_BMS_ERROR} 24000011 - Calling the Bundle Manager service failed;
* {@link ASSET_ACCOUNT_ERROR} 24000012 - Calling the OS Account service failed;
* {@link ASSET_ACCESS_TOKEN_ERROR} 24000013 - Calling the Access Token service failed;
* @since 11
*/
int32_t OH_Asset_PostQuery(const Asset_Attr *handle, uint32_t handleCnt);

View File

@ -216,85 +216,45 @@ typedef enum {
* @since 11
*/
typedef enum {
/**
* The operation is successful.
*/
/** @error The operation is successful. */
ASSET_SUCCESS = 0,
/**
* The caller does not have the required permission.
*/
/** @error The caller doesn't have the permission. */
ASSET_PERMISSION_DENIED = 201,
/**
* The parameter is invalid.
*/
/** @error The parameter is invalid. */
ASSET_INVALID_ARGUMENT = 401,
/**
* The asset service is unavailable.
*/
/** @error The ASSET service is unavailable. */
ASSET_SERVICE_UNAVAILABLE = 24000001,
/**
* The asset is not found.
*/
/** @error The asset is not found. */
ASSET_NOT_FOUND = 24000002,
/**
* The asset already exists.
*/
/** @error The asset already exists. */
ASSET_DUPLICATED = 24000003,
/**
* The access to the asset is denied.
*/
/** @error Access to the asset is denied. */
ASSET_ACCESS_DENIED = 24000004,
/**
* The lock screen status does not match the access control type specified.
*/
/** @error The screen lock status does not match. */
ASSET_STATUS_MISMATCH = 24000005,
/**
* The system memory is insufficient.
*/
/** @error Insufficient memory. */
ASSET_OUT_OF_MEMORY = 24000006,
/**
* The asset is corrupted.
*/
/** @error The asset is corrupted. */
ASSET_DATA_CORRUPTED = 24000007,
/**
* The database operation failed.
*/
/** @error The database operation failed. */
ASSET_DATABASE_ERROR = 24000008,
/**
* The cryptography operation failed.
*/
/** @error The cryptography operation failed. */
ASSET_CRYPTO_ERROR = 24000009,
/**
* The inter-process communication (IPC) failed.
*/
/** @error IPC failed. */
ASSET_IPC_ERROR = 24000010,
/**
* The Bundle Manager service is abnormal.
*/
/** @error Calling the Bundle Manager service failed. */
ASSET_BMS_ERROR = 24000011,
/**
* The Account service is abnormal.
*/
/** @error Calling the OS Account service failed. */
ASSET_ACCOUNT_ERROR = 24000012,
/**
* The Access Token service is abnormal.
*/
/** @error Calling the Access Token service failed. */
ASSET_ACCESS_TOKEN_ERROR = 24000013,
/**
* The file operation failed.
*/
/** @error The file operation failed. */
ASSET_FILE_OPERATION_ERROR = 24000014,
/**
* The operation for obtaining the system time failed.
*/
/** @error Getting the system time failed. */
ASSET_GET_SYSTEM_TIME_ERROR = 24000015,
/**
* The number of cached assets exceeds the limit.
*/
/** @error The cache exceeds the limit. */
ASSET_LIMIT_EXCEEDED = 24000016,
/**
* The function is not supported.
*/
/** @error The capability is not supported. */
ASSET_UNSUPPORTED = 24000017,
} Asset_ResultCode;