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 namespace OHOS {
20 namespace DataShare {
21 /**
22 * @brief The error code in the data share error case.
23 */
24 constexpr int DATA_SHARE_ERROR = -1;
25 
26 /**
27 * @brief The error code in the correct case.
28 */
29 constexpr int E_OK = 0;
30 
31 /**
32 * @brief The base code of the exception error code.
33 */
34 constexpr int E_BASE = 1000;
35 
36 /**
37 * @brief The error code for common exceptions.
38 */
39 constexpr int E_ERROR = (E_BASE + 1);
40 
41 /**
42 * @brief The error code for register exceptions.
43 */
44 constexpr int E_REGISTERED_REPEATED = (E_BASE + 2);
45 
46 
47 /**
48 * @brief The error code for register exceptions.
49 */
50 constexpr int E_UNREGISTERED_EMPTY = (E_BASE + 3);
51 
52 /**
53 * @brief The error code for invalid statement.
54 */
55 constexpr int E_INVALID_STATEMENT = (E_BASE + 7);
56 
57 /**
58 * @brief The error code for invalid column index.
59 */
60 constexpr int E_INVALID_COLUMN_INDEX = (E_BASE + 8);
61 
62 /**
63 * @brief The error code for invalid object type.
64 */
65 constexpr int E_INVALID_OBJECT_TYPE = (E_BASE + 20);
66 
67 /**
68 * @brief The error code for invalid parcel.
69 */
70 constexpr int E_INVALID_PARCEL = (E_BASE + 42);
71 
72 /**
73 * @brief The version is smaller than exist.
74 */
75 constexpr int E_VERSION_NOT_NEWER = (E_BASE + 45);
76 
77 /**
78 * @brief Cannot find the template
79 */
80 constexpr int E_TEMPLATE_NOT_EXIST = (E_BASE + 46);
81 
82 /**
83 * @brief Cannot find the subscriber
84 */
85 constexpr int E_SUBSCRIBER_NOT_EXIST = (E_BASE + 47);
86 
87 /**
88 * @brief Cannot find the uri
89 */
90 constexpr int E_URI_NOT_EXIST = (E_BASE + 48);
91 
92 /**
93 * @brief Cannot find the bundleName
94 */
95 constexpr int E_BUNDLE_NAME_NOT_EXIST = (E_BASE + 49);
96 
97 /**
98 * @brief BMS not ready
99 */
100 constexpr int E_BMS_NOT_READY = (E_BASE + 50);
101 
102 /**
103 * @brief metaData not exists
104 */
105 constexpr int E_METADATA_NOT_EXISTS = (E_BASE + 51);
106 
107 /**
108 * @brief silent proxy is disable
109 */
110 constexpr int E_SILENT_PROXY_DISABLE = (E_BASE + 52);
111 
112 /**
113 * @brief token is empty
114 */
115 constexpr int E_TOKEN_EMPTY = (E_BASE + 53);
116 
117 /**
118 * @brief ext uri is empty
119 */
120 constexpr int E_EXT_URI_INVALID = (E_BASE + 54);
121 
122 /**
123 * @brief DataShare not ready
124 */
125 constexpr int E_DATA_SHARE_NOT_READY = (E_BASE + 55);
126 
127 /**
128 * @brief The error code for db error.
129 */
130 constexpr int E_DB_ERROR = (E_BASE + 56);
131 
132 /**
133 * @brief The error code for data supplier error
134 */
135 constexpr int E_DATA_SUPPLIER_ERROR = (E_BASE + 57);
136 
137 /**
138 * @brief The error code for marshal error.
139 */
140 constexpr int E_MARSHAL_ERROR = (E_BASE + 58);
141 
142 /**
143 * @brief The error code for unmarshal error.
144 */
145 constexpr int E_UNMARSHAL_ERROR = (E_BASE + 59);
146 
147 /**
148 * @brief The error code for write interface token to data error.
149 */
150 constexpr int E_WRITE_TO_PARCE_ERROR = (E_BASE + 60);
151 
152 /**
153 * @brief The error code for resultSet busy error.
154 */
155 constexpr int E_RESULTSET_BUSY = (E_BASE + 61);
156 
157 /**
158 * @brief The error code for invalid appIndex error.
159 */
160 constexpr int E_APPINDEX_INVALID = (E_BASE + 62);
161 
162 /**
163 * @brief The error code for nullptr observer.
164 */
165 constexpr int E_NULL_OBSERVER = (E_BASE + 63);
166 
167 /**
168 * @brief The error code for reusing helper instance released before.
169 */
170 constexpr int E_HELPER_DIED = (E_BASE + 64);
171 
172 /**
173 * @brief The error code for failure to get dataobs client.
174 */
175 constexpr int E_DATA_OBS_NOT_READY = (E_BASE + 65);
176 
177 /**
178 * @brief The error code for failure to connect the provider.
179 */
180 constexpr int E_PROVIDER_NOT_CONNECTED = (E_BASE + 66);
181 
182 /**
183 * @brief The error code for failure to null connection.
184 */
185 constexpr int E_PROVIDER_CONN_NULL = (E_BASE + 67);
186 } // namespace DataShare
187 } // namespace OHOS
188 
189 #endif