1 /* 2 * Copyright (c) 2022 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 OHOS_ABILITY_RUNTIME_ABILITY_BUSINESS_ERROR_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_BUSINESS_ERROR_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace AbilityRuntime { 23 enum class AbilityErrorCode { 24 // success 25 ERROR_OK = 0, 26 27 // no such permission. 28 ERROR_CODE_PERMISSION_DENIED = 201, 29 30 // invalid param. 31 ERROR_CODE_INVALID_PARAM = 401, 32 33 // no such systemcap. 34 ERROR_CODE_SYSTEMCAP = 801, 35 36 // common inner error. 37 ERROR_CODE_INNER = 16000050, 38 39 // can not find target ability. 40 ERROR_CODE_RESOLVE_ABILITY = 16000001, 41 42 // ability type is wrong. 43 ERROR_CODE_INVALID_ABILITY_TYPE = 16000002, 44 45 // id does not exist. 46 ERROR_CODE_INVALID_ID = 16000003, 47 48 // no start invisible ability permission. 49 ERROR_CODE_NO_INVISIBLE_PERMISSION = 16000004, 50 51 // check static permission failed. 52 ERROR_CODE_STATIC_CFG_PERMISSION = 16000005, 53 54 // no permission to cross user. 55 ERROR_CODE_CROSS_USER = 16000006, 56 57 // crowdtest app expiration. 58 ERROR_CODE_CROWDTEST_EXPIRED = 16000008, 59 60 // wukong mode. 61 ERROR_CODE_WUKONG_MODE = 16000009, 62 63 // not allowed for continuation flag. 64 ERROR_CODE_CONTINUATION_FLAG = 16000010, 65 66 // context is invalid. 67 ERROR_CODE_INVALID_CONTEXT = 16000011, 68 69 // ability wait start. 70 ERROR_START_ABILITY_WAITTING = 16000017, 71 72 // free install network abnormal. 73 ERROR_CODE_NETWORK_ABNORMAL = 16000051, 74 75 // not support free install. 76 ERROR_CODE_NOT_SUPPORT_FREE_INSTALL = 16000052, 77 78 // not top ability, not enable to free install. 79 ERROR_CODE_NOT_TOP_ABILITY = 16000053, 80 81 // too busy for free install. 82 ERROR_CODE_FREE_INSTALL_TOO_BUSY = 16000054, 83 84 // free install timeout. 85 ERROR_CODE_FREE_INSTALL_TIMEOUT = 16000055, 86 87 // free install other ability. 88 ERROR_CODE_FREE_INSTALL_OTHERS = 16000056, 89 90 // invalid caller. 91 ERROR_CODE_INVALID_CALLER = 16200001, 92 93 // no such mission id. 94 ERROR_CODE_NO_MISSION_ID = 16300001, 95 96 // no such mission listener. 97 ERROR_CODE_NO_MISSION_LISTENER = 16300002, 98 }; 99 100 std::string GetErrorMsg(const AbilityErrorCode& errCode); 101 std::string GetNoPermissionErrorMsg(const std::string& permission); 102 AbilityErrorCode GetJsErrorCodeByNativeError(int32_t errCode); 103 } // namespace AbilityRuntime 104 } // namespace OHOS 105 #endif