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 DATASHARE_ERRNO_H 17 #define DATASHARE_ERRNO_H 18 19 #include "errors.h" 20 namespace OHOS { 21 namespace DataShare { 22 /** 23 * @brief The error code in the data share error case. 24 */ 25 constexpr int DATA_SHARE_ERROR = -1; 26 27 /** 28 * @brief The error code in the correct case. 29 */ 30 constexpr int E_OK = 0; 31 32 /** 33 * @brief The base code of the exception error code. 34 */ 35 constexpr int E_BASE = 1000; 36 37 /** 38 * @brief The error code for common exceptions. 39 */ 40 constexpr int E_ERROR = (E_BASE + 1); 41 42 /** 43 * @brief The error code for register exceptions. 44 */ 45 constexpr int E_REGISTERED_REPEATED = (E_BASE + 2); 46 47 48 /** 49 * @brief The error code for register exceptions. 50 */ 51 constexpr int E_UNREGISTERED_EMPTY = (E_BASE + 3); 52 53 /** 54 * @brief The error code for invalid statement. 55 */ 56 constexpr int E_INVALID_STATEMENT = (E_BASE + 7); 57 58 /** 59 * @brief The error code for invalid column index. 60 */ 61 constexpr int E_INVALID_COLUMN_INDEX = (E_BASE + 8); 62 63 /** 64 * @brief The error code for invalid object type. 65 */ 66 constexpr int E_INVALID_OBJECT_TYPE = (E_BASE + 20); 67 68 /** 69 * @brief The error code for invalid parcel. 70 */ 71 constexpr int E_INVALID_PARCEL = (E_BASE + 42); 72 73 /** 74 * @brief The version is smaller than exist. 75 */ 76 constexpr int E_VERSION_NOT_NEWER = (E_BASE + 45); 77 78 /** 79 * @brief Cannot find the template 80 */ 81 constexpr int E_TEMPLATE_NOT_EXIST = (E_BASE + 46); 82 83 /** 84 * @brief Cannot find the subscriber 85 */ 86 constexpr int E_SUBSCRIBER_NOT_EXIST = (E_BASE + 47); 87 88 /** 89 * @brief Cannot find the uri 90 */ 91 constexpr int E_URI_NOT_EXIST = (E_BASE + 48); 92 93 /** 94 * @brief Cannot find the bundleName 95 */ 96 constexpr int E_BUNDLE_NAME_NOT_EXIST = (E_BASE + 49); 97 98 /** 99 * @brief BMS not ready 100 */ 101 constexpr int E_BMS_NOT_READY = (E_BASE + 50); 102 103 /** 104 * @brief metaData not exists 105 */ 106 constexpr int E_METADATA_NOT_EXISTS = (E_BASE + 51); 107 108 /** 109 * @brief silent proxy is disable 110 */ 111 constexpr int E_SILENT_PROXY_DISABLE = (E_BASE + 52); 112 113 /** 114 * @brief token is empty 115 */ 116 constexpr int E_TOKEN_EMPTY = (E_BASE + 53); 117 118 /** 119 * @brief ext uri is empty 120 */ 121 constexpr int E_EXT_URI_INVALID = (E_BASE + 54); 122 123 /** 124 * @brief DataShare not ready 125 */ 126 constexpr int E_DATA_SHARE_NOT_READY = (E_BASE + 55); 127 128 /** 129 * @brief The error code for db error. 130 */ 131 constexpr int E_DB_ERROR = (E_BASE + 56); 132 133 /** 134 * @brief The error code for data supplier error 135 */ 136 constexpr int E_DATA_SUPPLIER_ERROR = (E_BASE + 57); 137 138 /** 139 * @brief The error code for marshal error. 140 */ 141 constexpr int E_MARSHAL_ERROR = (E_BASE + 58); 142 143 /** 144 * @brief The error code for unmarshal error. 145 */ 146 constexpr int E_UNMARSHAL_ERROR = (E_BASE + 59); 147 148 /** 149 * @brief The error code for write interface token to data error. 150 */ 151 constexpr int E_WRITE_TO_PARCE_ERROR = (E_BASE + 60); 152 153 /** 154 * @brief The error code for resultSet busy error. 155 */ 156 constexpr int E_RESULTSET_BUSY = (E_BASE + 61); 157 158 /** 159 * @brief The error code for invalid appIndex error. 160 */ 161 constexpr int E_APPINDEX_INVALID = (E_BASE + 62); 162 163 /** 164 * @brief The error code for nullptr observer. 165 */ 166 constexpr int E_NULL_OBSERVER = (E_BASE + 63); 167 168 /** 169 * @brief The error code for reusing helper instance released before. 170 */ 171 constexpr int E_HELPER_DIED = (E_BASE + 64); 172 173 /** 174 * @brief The error code for failure to get dataobs client. 175 */ 176 constexpr int E_DATA_OBS_NOT_READY = (E_BASE + 65); 177 178 /** 179 * @brief The error code for failure to connect the provider. 180 */ 181 constexpr int E_PROVIDER_NOT_CONNECTED = (E_BASE + 66); 182 183 /** 184 * @brief The error code for failure to null connection. 185 */ 186 constexpr int E_PROVIDER_CONN_NULL = (E_BASE + 67); 187 188 /** 189 * @brief The error code for passing invalid form of user id. 190 */ 191 constexpr int E_INVALID_USER_ID = (E_BASE + 68); 192 193 /** 194 * @brief The error code for not system app. 195 */ 196 constexpr int E_NOT_SYSTEM_APP = (E_BASE + 69); 197 198 /** 199 * @brief The error code for register observer inner error. 200 */ 201 constexpr int E_REGISTER_ERROR = (E_BASE + 70); 202 203 /** 204 * @brief The error code for notify change inner error. 205 */ 206 constexpr int E_NOTIFYCHANGE_ERROR = (E_BASE + 71); 207 208 /** 209 * @brief The error code for timeout inner error. 210 */ 211 constexpr int E_TIMEOUT_ERROR = (E_BASE + 72); 212 213 /** 214 * @brief This error code indicates that the timeout interface is busy. 215 */ 216 constexpr int E_ERROR_OVER_LIMIT_TASK = (E_BASE + 73); 217 218 /** 219 * @brief The error code for pool is null. 220 */ 221 constexpr int E_EXECUTOR_POOL_IS_NULL = (E_BASE + 74); 222 223 /** 224 * @brief The error code for not hap. 225 */ 226 constexpr int E_NOT_HAP = (E_BASE + 75); 227 228 /** 229 * @brief The error code for get bundle info failed. 230 */ 231 constexpr int E_GET_BUNDLEINFO_FAILED = (E_BASE + 76); 232 233 /** 234 * @brief The error code for not datashare extension. 235 */ 236 constexpr int E_NOT_DATASHARE_EXTENSION = (E_BASE + 77); 237 238 /** 239 * @brief The error code for invalid uri. 240 */ 241 constexpr int E_DATASHARE_INVALID_URI = (E_BASE + 78); 242 243 /** 244 * @brief The error code for verify failed. 245 */ 246 constexpr int E_VERIFY_FAILED = (E_BASE + 79); 247 248 /** 249 * @brief The error code for permission denied. 250 */ 251 constexpr int E_DATASHARE_PERMISSION_DENIED = (E_BASE + 80); 252 253 /** 254 * @brief The error code for empty uri. 255 */ 256 constexpr int E_EMPTY_URI = (E_BASE + 81); 257 258 /** 259 * @brief The error code for uri not trust. 260 */ 261 constexpr int E_NOT_IN_TRUSTS = (E_BASE + 82); 262 263 /** 264 * @brief The error code for get caller failed. 265 */ 266 constexpr int E_GET_CALLER_NAME_FAILED = (E_BASE + 83); 267 268 } // namespace DataShare 269 } // namespace OHOS 270 271 #endif