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 JS_ERROR_CODE_H 17 #define JS_ERROR_CODE_H 18 19 #include <string> 20 21 #include "telephony_errors.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 enum JsErrorCode { 26 /** 27 * Permission denied. 28 */ 29 JS_ERROR_TELEPHONY_PERMISSION_DENIED = 201, 30 31 /** 32 * Non system applications use system APIs. 33 */ 34 JS_ERROR_ILLEGAL_USE_OF_SYSTEM_API = 202, 35 36 /** 37 * Invalid parameter value. The types of parameters should match, or the number of parameters must match. 38 */ 39 JS_ERROR_TELEPHONY_INVALID_INPUT_PARAMETER = 401, 40 41 /** 42 * The device does not support this API. It is usually used to support a small number of APIs when the device has 43 * supported the SysCap. 44 */ 45 JS_ERROR_DEVICE_NOT_SUPPORT_THIS_API = 801, 46 47 /** 48 * Success. 49 */ 50 JS_ERROR_TELEPHONY_SUCCESS = 8300000, 51 52 /** 53 * The input parameter value is out of range. 54 */ 55 JS_ERROR_TELEPHONY_ARGUMENT_ERROR, 56 57 /** 58 * Operation failed. Cannot connect to service. 59 */ 60 JS_ERROR_TELEPHONY_SERVICE_ERROR, 61 62 /** 63 * System internal error. 64 */ 65 JS_ERROR_TELEPHONY_SYSTEM_ERROR, 66 67 /** 68 * Do not have sim card. 69 */ 70 JS_ERROR_TELEPHONY_NO_SIM_CARD, 71 72 /** 73 * Unknown error code. 74 */ 75 JS_ERROR_TELEPHONY_UNKNOW_ERROR = 8300999, 76 77 /** 78 * Sim module base error code. 79 */ 80 JS_ERROR_SIM_BASE_ERROR = 8301000, 81 82 /** 83 * SIM card is not activated. 84 */ 85 JS_ERROR_SIM_CARD_IS_NOT_ACTIVE, 86 87 /** 88 * SIM card operation error. 89 */ 90 JS_ERROR_SIM_CARD_OPERATION_ERROR, 91 92 /** 93 * Operator config error. 94 */ 95 JS_ERROR_OPERATOR_CONFIG_ERROR, 96 97 /** 98 * Network search module base error code. 99 */ 100 JS_ERROR_NETWORK_SEARCH_BASE_ERROR = 8302000, 101 102 /** 103 * Call manager module base error code. 104 */ 105 JS_ERROR_CALL_MANAGER_BASE_ERROR = 8401000, 106 107 /** 108 * UT is not connected. 109 */ 110 JS_ERROR_CALL_UT_NO_CONNECTION, 111 112 /** 113 * Cellular call module cs base error code. 114 */ 115 JS_ERROR_CELLULAR_CALL_CS_BASE_ERROR = 8501000, 116 117 /** 118 * Cellular call module ims base error code. 119 */ 120 JS_ERROR_CELLULAR_CALL_IMS_BASE_ERROR = 8502000, 121 122 /** 123 * Cellular data module base error code. 124 */ 125 JS_ERROR_CELLULAR_DATA_BASE_ERROR = 8601000, 126 127 /** 128 * Sms mms module base error code. 129 */ 130 JS_ERROR_SMS_MMS_BASE_ERROR = 8701000, 131 132 /** 133 * State registry module base error code. 134 */ 135 JS_ERROR_STATE_REGISTRY_BASE_ERROR = 8801000, 136 }; 137 138 struct JsError { 139 JsErrorCode errorCode; 140 std::string errorMessage; 141 }; 142 } // namespace Telephony 143 } // namespace OHOS 144 #endif // JS_ERROR_CODE_H 145