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 #ifndef OBJECTSTORE_ERRORS_H 16 #define OBJECTSTORE_ERRORS_H 17 18 namespace OHOS::ObjectStore { 19 constexpr uint32_t BASE_ERR_OFFSET = 1650; 20 21 /* module defined errors */ 22 /** 23 * @brief Executed successfully. 24 */ 25 constexpr uint32_t SUCCESS = 0; 26 27 /** 28 * @brief Database setup failure. 29 */ 30 constexpr uint32_t ERR_DB_SET_PROCESS = BASE_ERR_OFFSET + 1; 31 32 /** 33 * @brief Already exit. 34 */ 35 constexpr uint32_t ERR_EXIST = BASE_ERR_OFFSET + 2; 36 37 /** 38 * @brief Illegal data length. 39 */ 40 constexpr uint32_t ERR_DATA_LEN = BASE_ERR_OFFSET + 3; 41 42 /** 43 * @brief Memory allocation failure. 44 */ 45 constexpr uint32_t ERR_NOMEM = BASE_ERR_OFFSET + 4; 46 47 /** 48 * @brief Database is not initialized. 49 */ 50 constexpr uint32_t ERR_DB_NOT_INIT = BASE_ERR_OFFSET + 5; 51 52 /** 53 * @brief Kvstore error. 54 */ 55 constexpr uint32_t ERR_DB_GETKV_FAIL = BASE_ERR_OFFSET + 6; 56 57 /** 58 * @brief Database not exist. 59 */ 60 constexpr uint32_t ERR_DB_NOT_EXIST = BASE_ERR_OFFSET + 7; 61 62 /** 63 * @brief Get database data failure. 64 */ 65 constexpr uint32_t ERR_DB_GET_FAIL = BASE_ERR_OFFSET + 8; 66 67 /** 68 * @brief Get database entry failure. 69 */ 70 constexpr uint32_t ERR_DB_ENTRY_FAIL = BASE_ERR_OFFSET + 9; 71 72 /** 73 * @brief Close database failure. 74 */ 75 constexpr uint32_t ERR_CLOSE_STORAGE = BASE_ERR_OFFSET + 10; 76 77 /** 78 * @brief The object is null. 79 */ 80 constexpr uint32_t ERR_NULL_OBJECT = BASE_ERR_OFFSET + 11; 81 82 /** 83 * @brief registration failed. 84 */ 85 constexpr uint32_t ERR_REGISTER = BASE_ERR_OFFSET + 12; 86 87 /** 88 * @brief The object store is null. 89 */ 90 constexpr uint32_t ERR_NULL_OBJECTSTORE = BASE_ERR_OFFSET + 13; 91 92 /** 93 * @brief Get the object failure. 94 */ 95 constexpr uint32_t ERR_GET_OBJECT = BASE_ERR_OFFSET + 14; 96 97 /** 98 * @brief Unregistered. 99 */ 100 constexpr uint32_t ERR_NO_OBSERVER = BASE_ERR_OFFSET + 15; 101 102 /** 103 * @brief Deregistration failure. 104 */ 105 constexpr uint32_t ERR_UNRIGSTER = BASE_ERR_OFFSET + 16; 106 107 /** 108 * @brief Only one device. 109 */ 110 constexpr uint32_t ERR_SINGLE_DEVICE = BASE_ERR_OFFSET + 17; 111 112 /** 113 * @brief The pointer is null. 114 */ 115 constexpr uint32_t ERR_NULL_PTR = BASE_ERR_OFFSET + 18; 116 117 /** 118 * @brief Processing failure. 119 */ 120 constexpr uint32_t ERR_PROCESSING = BASE_ERR_OFFSET + 19; 121 122 /** 123 * @brief ResultSet processing failure. 124 */ 125 constexpr uint32_t ERR_RESULTSET = BASE_ERR_OFFSET + 20; 126 127 /** 128 * @brief Input parameters error. 129 */ 130 constexpr uint32_t ERR_INVALID_ARGS = BASE_ERR_OFFSET + 21; 131 132 /** 133 * @brief Ipc error. 134 */ 135 constexpr uint32_t ERR_IPC = BASE_ERR_OFFSET + 22; 136 137 /** 138 * @brief No DATA_SYNC permission. 139 */ 140 constexpr uint32_t ERR_NO_PERMISSION = BASE_ERR_OFFSET + 23; 141 } // namespace OHOS::ObjectStore 142 143 #endif 144