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