1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OS_ACCOUNT_FRAMEWORKS_COMMON_ACCOUNT_ERROR_INCLUDE_ACCOUNT_ERROR_NO_H 17 #define OS_ACCOUNT_FRAMEWORKS_COMMON_ACCOUNT_ERROR_INCLUDE_ACCOUNT_ERROR_NO_H 18 19 #include <cstdint> 20 #include "errors.h" 21 22 namespace OHOS { 23 enum { 24 ACCOUNT_MODULE_COMMON = 0x00, 25 ACCOUNT_MODULE_ACCOUNTMGR, 26 ACCOUNT_MODULE_DATADEAL, 27 ACCOUNT_MODULE_IACCOUNT, 28 ACCOUNT_MODULE_APPACCOUNT_KIT, 29 ACCOUNT_MODULE_APPACCOUNT_SERVICE, 30 ACCOUNT_MODULE_OSACCOUNT_KIT, 31 ACCOUNT_MODULE_OSACCOUNT_SERVICE, 32 ACCOUNT_MODULE_ACCOUNT_IAM_KIT, 33 ACCOUNT_MODULE_OHOSACCOUNT_SERVICE, 34 ACCOUNT_MODULE_DOMAIN_ACCOUNT_SERVICE 35 }; 36 37 // Error code for common 38 constexpr ErrCode ACCOUNT_COMMON_ERR_OFFSET = ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_COMMON); 39 enum { 40 ERR_ACCOUNT_COMMON_NOT_INIT_ERROR = ACCOUNT_COMMON_ERR_OFFSET + 0x0001, 41 ERR_ACCOUNT_COMMON_NOT_SYSTEM_APP_ERROR, 42 ERR_ACCOUNT_COMMON_DUMP_JSON_ERROR, 43 ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR, 44 ERR_ACCOUNT_COMMON_NULL_PTR_ERROR, 45 ERR_ACCOUNT_COMMON_WRITE_DESCRIPTOR_ERROR, 46 ERR_ACCOUNT_COMMON_CHECK_DESCRIPTOR_ERROR, 47 ERR_ACCOUNT_COMMON_PERMISSION_DENIED, 48 ERR_ACCOUNT_COMMON_CHECK_KVSTORE_ERROR, 49 ERR_ACCOUNT_COMMON_DELETE_KEY_FROM_KVSTORE_ERROR, 50 ERR_ACCOUNT_COMMON_BAD_JSON_FORMAT_ERROR, 51 ERR_ACCOUNT_COMMON_CONNECT_ABILITY_MANAGER_SERVICE_ERROR, 52 ERR_ACCOUNT_COMMON_INTERFACE_NOT_SUPPORT_ERROR, 53 ERR_ACCOUNT_COMMON_CONNECT_BUNDLE_MANAGER_SERVICE_ERROR, 54 ERR_ACCOUNT_COMMON_GET_SYSTEM_ABILITY_MANAGER, 55 ERR_ACCOUNT_COMMON_GET_SYSTEM_ABILITY, 56 ERR_ACCOUNT_COMMON_GET_PROXY, 57 ERR_ACCOUNT_COMMON_CREATE_DEATH_RECIPIENT, 58 ERR_ACCOUNT_COMMON_ADD_DEATH_RECIPIENT, 59 ERR_ACCOUNT_COMMON_WRITE_PARCEL_ERROR, 60 ERR_ACCOUNT_COMMON_READ_PARCEL_ERROR, 61 ERR_ACCOUNT_COMMON_INVALID_PARAMETER, 62 ERR_ACCOUNT_COMMON_POST_TASK, 63 ERR_ACCOUNT_COMMON_FILE_OPEN_FAILED, 64 ERR_ACCOUNT_COMMON_FILE_WRITE_FAILED, 65 ERR_ACCOUNT_COMMON_ACCOUNT_NOT_EXIST_ERROR, 66 }; 67 68 // Error code for AccountMgr 69 constexpr ErrCode ACCOUNT_ACCOUNTMGR_ERR_OFFSET = ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_ACCOUNTMGR); 70 enum { 71 ERR_ACCOUNT_MGR_DUMP_ERROR = ACCOUNT_ACCOUNTMGR_ERR_OFFSET + 0x0001, 72 ERR_ACCOUNT_MGR_GET_REMOTE_SA_ERROR, 73 ERR_ACCOUNT_MGR_CONNECT_SA_ERROR, 74 ERR_ACCOUNT_MGR_ADD_TO_SA_ERROR, 75 ERR_ACCOUNT_MGR_OHOS_MGR_INIT_ERROR 76 }; 77 78 // Error code for DataDeal module 79 constexpr ErrCode ACCOUNT_DATADEAL_ERR_OFFSET = ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_DATADEAL); 80 enum { 81 ERR_ACCOUNT_DATADEAL_INPUT_FILE_ERROR = ACCOUNT_DATADEAL_ERR_OFFSET + 0x0001, 82 ERR_ACCOUNT_DATADEAL_NOT_READY, 83 ERR_ACCOUNT_DATADEAL_JSON_FILE_CORRUPTION 84 }; 85 86 // Error code for IAccount 87 constexpr ErrCode ACCOUNT_IACCOUNT_ERR_OFFSET = ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_IACCOUNT); 88 enum { 89 ERR_ACCOUNT_ZIDL_ACCOUNT_STUB_ERROR = ACCOUNT_IACCOUNT_ERR_OFFSET + 0x0001, 90 ERR_ACCOUNT_ZIDL_ACCOUNT_SERVICE_ERROR, 91 ERR_ACCOUNT_ZIDL_MGR_NOT_READY_ERROR, 92 ERR_ACCOUNT_ZIDL_ACCOUNT_STUB_USERID_ERROR 93 }; 94 95 // Error code for APPACCOUNT_KIT 96 constexpr ErrCode APPACCOUNT_KIT_ERR_OFFSET = ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_APPACCOUNT_KIT); 97 enum { 98 // AppAccount::GetAppAccountProxy 4456449 99 ERR_APPACCOUNT_KIT_GET_APP_ACCOUNT_SERVICE = APPACCOUNT_KIT_ERR_OFFSET + 0x0001, 100 ERR_APPACCOUNT_KIT_CREATE_APP_ACCOUNT_DEATH_RECIPIENT, 101 // AppAccount 4456455 102 ERR_APPACCOUNT_KIT_SUBSCRIBER_IS_NULLPTR, 103 ERR_APPACCOUNT_KIT_GET_SUBSCRIBE_INFO, 104 ERR_APPACCOUNT_KIT_GET_OWNERS, 105 ERR_APPACCOUNT_KIT_SET_OWNERS, 106 ERR_APPACCOUNT_KIT_SUBSCRIBE, 107 ERR_APPACCOUNT_KIT_NO_SPECIFIED_SUBSCRIBER_HAS_BEEN_REGISTERED, 108 // AppAccountProxy & AppAccountEventProxy 4456480 109 ERR_APPACCOUNT_KIT_SEND_REQUEST, 110 ERR_APPACCOUNT_KIT_READ_PARCELABLE_APP_ACCOUNT_INFO, 111 // AppAccountStub 4456503 112 ERR_APPACCOUNT_KIT_READ_PARCELABLE_VECTOR_ACCOUNT_INFO, 113 }; 114 115 // Error code for APPACCOUNT_SERVICE 116 constexpr ErrCode APPACCOUNT_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_APPACCOUNT_SERVICE); 117 enum { 118 // 4521985 119 ERR_APPACCOUNT_SERVICE_ACCOUNT_NOT_EXIST = APPACCOUNT_SERVICE_ERR_OFFSET + 0x0001, 120 // InnerAppAccountManager 4521995 121 ERR_APPACCOUNT_SERVICE_DATA_STORAGE_PTR_IS_NULLPTR, 122 ERR_APPACCOUNT_SERVICE_ACCOUNT_MAX_SIZE, 123 ERR_APPACCOUNT_SERVICE_GET_ACCOUNT_INFO_BY_ID, 124 ERR_APPACCOUNT_SERVICE_GET_ASSOCIATED_DATA, 125 ERR_APPACCOUNT_SERVICE_SET_ASSOCIATED_DATA, 126 ERR_APPACCOUNT_SERVICE_ACCOUNT_CREDENTIAL_NOT_EXIST, 127 ERR_APPACCOUNT_SERVICE_GET_OWNER, 128 ERR_APPACCOUNT_SERVICE_GET_BUNDLE_NAME, 129 ERR_APPACCOUNT_SERVICE_GET_APP_INDEX, 130 ERR_APPACCOUNT_SERVICE_GET_BUNDLE_INFO, 131 ERR_APPACCOUNT_SERVICE_ADD_EXISTING_ACCOUNT, 132 ERR_APPACCOUNT_SERVICE_ENABLE_APP_ACCESS_ALREADY_EXISTS, 133 ERR_APPACCOUNT_SERVICE_DISABLE_APP_ACCESS_NOT_EXISTED, 134 ERR_APPACCOUNT_SERVICE_ASSOCIATED_DATA_KEY_NOT_EXIST, 135 ERR_APPACCOUNT_SERVICE_ASSOCIATED_DATA_OVER_SIZE, 136 // AppAccountOAuth 137 ERR_APPACCOUNT_SERVICE_OAUTH_TOKEN_NOT_EXIST, 138 ERR_APPACCOUNT_SERVICE_OAUTH_TYPE_NOT_EXIST, 139 ERR_APPACCOUNT_SERVICE_OAUTH_TOKEN_MAX_SIZE, 140 ERR_APPACCOUNT_SERVICE_OAUTH_LIST_MAX_SIZE, 141 ERR_APPACCOUNT_SERVICE_OAUTH_AUTHENTICATOR_NOT_EXIST, 142 ERR_APPACCOUNT_SERVICE_OAUTH_AUTHENTICATOR_CALLBACK_NOT_EXIST, 143 ERR_APPACCOUNT_SERVICE_OAUTH_SESSION_NOT_EXIST, 144 ERR_APPACCOUNT_SERVICE_OAUTH_BUSY, 145 ERR_APPACCOUNT_SERVICE_OAUTH_INVALID_RESPONSE, 146 ERR_APPACCOUNT_SERVICE_OAUTH_SERVICE_EXCEPTION, 147 // AppAccountSubscribeManager 4522034 148 ERR_APPACCOUNT_SERVICE_OWNERS_SIZE_IS_ZERO, 149 ERR_APPACCOUNT_SUBSCRIBER_ALREADY_REGISTERED, 150 ERR_APPACCOUNT_SERVICE_OTHER, 151 }; 152 153 // Error code for OSACCOUNT_KIT 154 constexpr ErrCode ACCOUNT_OSACCOUNT_KIT_ERR_OFFSET = ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_OSACCOUNT_KIT); 155 enum { 156 ERR_OSACCOUNT_KIT_CREATE_OS_ACCOUNT_FOR_DOMAIN_ERROR = ACCOUNT_OSACCOUNT_KIT_ERR_OFFSET + 0x0001, 157 ERR_OSACCOUNT_KIT_READ_LOCALNAME_ERROR, 158 ERR_OSACCOUNT_KIT_READ_IN_LOCAL_ID_ERROR, 159 ERR_OSACCOUNT_KIT_GET_APP_ACCOUNT_SERVICE_ERROR, 160 ERR_OSACCOUNT_KIT_CREATE_APP_ACCOUNT_DEATH_RECIPIENT_ERROR, 161 ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR, 162 ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_CONSTRAINT_ENABLE_ERROR, 163 ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR, 164 ERR_OSACCOUNT_KIT_GET_CREATED_OS_ACCOUNT_COUNT_ERROR, 165 ERR_OSACCOUNT_KIT_GET_OS_ACCOUNT_ALL_CONSTRAINTS_ERROR, 166 ERR_OSACCOUNT_KIT_QUERY_CURRENT_OS_ACCOUNT_ERROR, 167 ERR_OSACCOUNT_KIT_READ_CONSTRAINTS_ERROR, 168 ERR_OSACCOUNT_KIT_GET_DISTRIBUTED_VIRTUAL_DEVICE_ID_ERROR, 169 ERR_OSACCOUNT_KIT_SUBSCRIBE_ERROR, 170 ERR_OSACCOUNT_KIT_NO_SPECIFIED_SUBSCRIBER_HAS_BEEN_REGISTERED, 171 }; 172 173 // Error code for OSACCOUNT_SERVICE 174 constexpr ErrCode ACCOUNT_OSACCOUNT_SERVICE_ERR_OFFSET = 175 ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_OSACCOUNT_SERVICE); 176 enum { 177 // 4653057 178 ERR_OSACCOUNT_SERVICE_MANAGER_QUERY_DISTRIBUTE_DATA_ERROR = ACCOUNT_OSACCOUNT_SERVICE_ERR_OFFSET + 0x0001, 179 ERR_OSACCOUNT_SERVICE_MANAGER_NOT_ENABLE_MULTI_ERROR, 180 ERR_OSACCOUNT_SERVICE_MANAGER_ID_ERROR, 181 ERR_OSACCOUNT_SERVICE_MANAGER_CREATE_OSACCOUNT_TYPE_ERROR, 182 // 4653067 183 ERR_OSACCOUNT_SERVICE_INNER_SELECT_ERROR, 184 ERR_OSACCOUNT_SERVICE_INNER_UPDATE_ACCOUNT_ERROR, 185 ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_IS_UNVERIFIED_ERROR, 186 ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_ALREADY_ACTIVE_ERROR, 187 ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_STOP_ACTIVE_ERROR, 188 ERR_OSACCOUNT_SERVICE_INNER_REMOVE_ACCOUNT_ACTIVED_ERROR, 189 ERR_OSACCOUNT_SERVICE_INNER_DOMAIN_ALREADY_BIND_ERROR, 190 ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_TO_BE_REMOVED_ERROR, 191 // 4653108 192 ERR_OSACCOUNT_SERVICE_CONTROL_GET_TYPE_ERROR, 193 ERR_OSACCOUNT_SERVICE_CONTROL_INSERT_FILE_EXISTS_ERROR, 194 ERR_OSACCOUNT_SERVICE_CONTROL_UPDATE_FILE_NOT_EXISTS_ERROR, 195 ERR_OSACCOUNT_SERVICE_CONTROL_MAX_CAN_CREATE_ERROR, 196 ERR_OSACCOUNT_SERVICE_CONTROL_SELECT_CAN_USE_ID_ERROR, 197 ERR_OSACCOUNT_SERVICE_CONTROL_ID_CANNOT_CREATE_ERROR, 198 ERR_OSACCOUNT_SERVICE_CONTROL_CANNOT_DELETE_ID_ERROR, 199 // 4653130 200 ERR_OSACCOUNT_SERVICE_FILE_DELE_ERROR, 201 ERR_OSACCOUNT_SERVICE_FILE_FIND_FILE_ERROR, 202 ERR_OSACCOUNT_SERVICE_FILE_CREATE_DIR_ERROR, 203 ERR_OSACCOUNT_SERVICE_FILE_CHANGE_DIR_MODE_ERROR, 204 ERR_OSACCOUNT_SERVICE_DATA_STORAGE_KEY_NOT_EXISTS_ERROR, 205 ERR_OSACCOUNT_SERVICE_DATA_STORAGE_KEY_EXISTED_ERROR, 206 ERR_OSACCOUNT_SERVICE_ACCOUNT_INFO_EMPTY_ERROR, 207 // 4653141 208 ERR_OSACCOUNT_SERVICE_INTERFACE_TO_AM_ACCOUNT_START_ERROR, 209 ERR_OSACCOUNT_SERVICE_INTERFACE_TO_BM_ACCOUNT_CREATE_ERROR, 210 ERR_OSACCOUNT_SERVICE_INTERFACE_TO_BM_ACCOUNT_DELETE_ERROR, 211 ERR_OSACCOUNT_SERVICE_OS_FILE_GET_CONFIG_ERROR, 212 ERR_OSACCOUNT_SERVICE_OS_FILE_GET_CONSTRAINTS_LITS_ERROR, 213 ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_OPERATING_ERROR, 214 ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_BASE_CONSTRAINTS_FILE_EMPTY, 215 ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_GLOBAL_CONSTRAINTS_FILE_EMPTY, 216 ERR_OSACCOUNT_SERVICE_GET_DATA_FROM_SPECIFIC_CONSTRAINTS_FILE_EMPTY, 217 ERR_OSACCOUNT_SERVICE_STORAGE_PREPARE_ADD_USER_FAILED, 218 }; 219 220 // Error code for ACCOUNT_IAM_KIT 221 constexpr ErrCode ACCOUNT_IAM_KIT_ERR_OFFSET = 222 ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_ACCOUNT_IAM_KIT); 223 enum { 224 ERR_ACCOUNT_IAM_KIT_INPUTER_ALREADY_REGISTERED = ACCOUNT_IAM_KIT_ERR_OFFSET + 0x0001, 225 ERR_ACCOUNT_IAM_KIT_INPUTER_NOT_REGISTERED, 226 ERR_ACCOUNT_IAM_KIT_GET_USERID_FAIL, 227 ERR_ACCOUNT_IAM_UNSUPPORTED_AUTH_TYPE 228 }; 229 230 // Error code for OHOSACCOUNT_SERVICE 231 constexpr ErrCode ACCOUNT_OHOSACCOUNT_SERVICE_ERR_OFFSET = 232 ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_OHOSACCOUNT_SERVICE); 233 enum { 234 ERR_OHOSACCOUNT_SERVICE_FILE_CHANGE_DIR_MODE_ERROR = ACCOUNT_OHOSACCOUNT_SERVICE_ERR_OFFSET + 0x0001, 235 }; 236 237 // Error code for DOMAIN_ACCOUNT_SERVICE 238 constexpr ErrCode DOMAIN_ACCOUNT_ERR_OFFSET = 239 ErrCodeOffset(SUBSYS_ACCOUNT, ACCOUNT_MODULE_DOMAIN_ACCOUNT_SERVICE); 240 enum { 241 ERR_DOMAIN_ACCOUNT_SERVICE_PLUGIN_ALREADY_EXIST = DOMAIN_ACCOUNT_ERR_OFFSET + 0x0001, 242 ERR_DOMAIN_ACCOUNT_SERVICE_PLUGIN_NOT_EXIST, 243 ERR_DOMAIN_ACCOUNT_SERVICE_NOT_DOMAIN_ACCOUNT, 244 ERR_DOMAIN_ACCOUNT_SERVICE_INVALID_CALLING_UID, 245 ERR_DOMAIN_ACCOUNT_SERVICE_ERR_CODE_LIMIT, 246 }; 247 248 enum JSErrorCode { 249 ERR_JS_SUCCESS = 0, 250 ERR_JS_PERMISSION_DENIED = 201, 251 ERR_JS_IS_NOT_SYSTEM_APP = 202, 252 ERR_JS_PARAMETER_ERROR = 401, 253 ERR_JS_CAPABILITY_NOT_SUPPORTED = 801, 254 ERR_JS_SYSTEM_SERVICE_EXCEPTION = 12300001, 255 ERR_JS_INVALID_PARAMETER = 12300002, 256 ERR_JS_ACCOUNT_NOT_FOUND = 12300003, 257 ERR_JS_ACCOUNT_ALREADY_EXIST = 12300004, 258 ERR_JS_MULTI_USER_NOT_SUPPORT = 12300005, 259 ERR_JS_ACCOUNT_TYPE_NOT_SUPPORT = 12300006, 260 ERR_JS_ACCOUNT_NUMBER_REACH_LIMIT = 12300007, 261 ERR_JS_ACCOUNT_RESTRICTED = 12300008, 262 ERR_JS_ACCOUNT_ALREADY_ACTIVATED = 12300009, 263 ERR_JS_ACCOUNT_SERVICE_BUSY = 12300010, 264 ERR_JS_LISTENER_ALREADY_REGISTERED = 12300011, 265 ERR_JS_LISTENER_NOT_REGISTERED = 12300012, 266 ERR_JS_PLUGIN_NETWORK_EXCEPTION = 12300013, 267 268 ERR_JS_AUTH_CREDENTIAL_WRONG_ERROR = 12300101, 269 ERR_JS_CREDENTIAL_NOT_EXIST = 12300102, 270 ERR_JS_CREDENTIAL_INPUTER_ALREADY_EXIST = 12300103, 271 ERR_JS_CREDENTIAL_INPUTER_NOT_EXIST = 12300104, 272 ERR_JS_TRUST_LEVEL_NOT_SUPPORTED = 12300105, 273 ERR_JS_AUTH_TYPE_NOT_SUPPORTED = 12300106, 274 ERR_JS_AUTH_TYPE_NOT_FOUND = 12300107, 275 ERR_JS_SESSION_NOT_EXIST = 12300108, 276 ERR_JS_AUTH_CANCELLED = 12300109, 277 ERR_JS_AUTH_SERVICE_LOCKED = 12300110, 278 ERR_JS_AUTH_TIMEOUT = 12300111, 279 ERR_JS_AUTH_SERVICE_BUSY = 12300112, 280 ERR_JS_ACCOUNT_AUTHENTICATOR_NOT_EXIST = 12300113, 281 ERR_JS_ACCOUNT_AUTHENTICATOR_SERVICE_EXCEPTION = 12300114, 282 ERR_JS_CREDENTIAL_NUMBER_REACH_LIMIT = 12300115, 283 ERR_JS_SESSION_TIMEOUT = 12300116, 284 285 ERR_JS_DOMAIN_PLUGIN_ALREADY_REGISTERED = 12300201, 286 287 ERR_JS_INVALID_CONTEXT_ID = 12300002, 288 289 ERR_JS_APPLICATION_NOT_EXIST = 12400001, 290 ERR_JS_CUSTOM_DATA_NOT_FOUND = 12400002, 291 ERR_JS_CUSTOM_DATA_NUMBER_REACH_LIMIT = 12400003, 292 ERR_JS_TOKEN_NUMBER_REACH_LIMIT = 12400004, 293 ERR_JS_AUTHORIZATION_LIST_TOO_LARGE = 12400005 294 }; 295 296 int32_t ConvertToJSErrCode(int32_t nativeErrCode); 297 } // namespace OHOS 298 299 #endif // OS_ACCOUNT_FRAMEWORKS_COMMON_ACCOUNT_ERROR_INCLUDE_ACCOUNT_ERROR_NO_H 300