• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 PREFERENCES_ERRNO_H
17 #define PREFERENCES_ERRNO_H
18 
19 #include <errno.h>
20 
21 namespace OHOS {
22 namespace NativePreferences {
23 
24 /**
25 * @brief The error code in the correct case.
26 */
27 constexpr int E_OK = 0;
28 
29 /**
30 * @brief The base code of the exception error code.
31 */
32 constexpr int E_BASE = 15500000;
33 
34 /**
35 * @brief The error when the capability not supported.
36 */
37 constexpr int E_NOT_SUPPORTED = 801;
38 
39 /**
40 * @brief The error code for common exceptions.
41 */
42 constexpr int E_ERROR = E_BASE;
43 
44 /**
45 * @brief The error code for resource has been stopped, killed or destroyed.
46 */
47 constexpr int E_STALE = (E_BASE + 1); // Resource has been stopped, killed or destroyed.
48 
49 /**
50 * @brief The error code for the input args is invalid.
51 */
52 constexpr int E_INVALID_ARGS = (E_BASE + 2); // the input args is invalid.
53 
54 /**
55 * @brief The error code for out of memory.
56 */
57 constexpr int E_OUT_OF_MEMORY = (E_BASE + 3); // out of memory
58 
59 /**
60 * @brief The error code for operation is not permitted.
61 */
62 constexpr int E_NOT_PERMIT = (E_BASE + 4); // operation is not permitted
63 
64 /**
65 * @brief The error code for the key is empty.
66 */
67 constexpr int E_KEY_EMPTY = (E_BASE + 5);
68 
69 /**
70 * @brief The error code for the key string length exceed the max length (80).
71 */
72 constexpr int E_KEY_EXCEED_MAX_LENGTH = (E_BASE + 6);
73 
74 /**
75 * @brief The error code for the former Preferences object pointer is held by another thread and may
76 * not be able to be deleted.
77 */
78 constexpr int E_PTR_EXIST_ANOTHER_HOLDER = (E_BASE + 7);
79 
80 /**
81 * @brief The error code for the file path is relative path.
82 */
83 constexpr int E_RELATIVE_PATH = (E_BASE + 8);
84 
85 /**
86 * @brief The error code for the file path is empty.
87 */
88 constexpr int E_EMPTY_FILE_PATH = (E_BASE + 9);
89 
90 /**
91 * @brief The error code when deleting a file fails.
92 */
93 constexpr int E_DELETE_FILE_FAIL = (E_BASE + 10);
94 
95 /**
96 * @brief The error code for the file name is empty.
97 */
98 constexpr int E_EMPTY_FILE_NAME = (E_BASE + 11);
99 
100 /**
101 * @brief The error code for the file path is invalid.
102 */
103 constexpr int E_INVALID_FILE_PATH = (E_BASE + 12);
104 
105 /**
106 * @brief The error code for the file path exceeds the max length.
107 */
108 constexpr int E_PATH_EXCEED_MAX_LENGTH = (E_BASE + 13);
109 
110 /**
111 * @brief The error code for the value exceeds the max length (8 * 1024).
112 */
113 constexpr int E_VALUE_EXCEED_MAX_LENGTH = (E_BASE + 14);
114 
115 /**
116 * @brief The error code for the key exceeds the length limit (32).
117 */
118 constexpr int E_KEY_EXCEED_LENGTH_LIMIT = (E_BASE + 15);
119 
120 /**
121 * @brief The error code for the value exceeds the length limit (128).
122 */
123 constexpr int E_VALUE_EXCEED_LENGTH_LIMIT = (E_BASE + 16);
124 
125 /**
126 * @brief The error code for the default exceeds the max length (128).
127 */
128 constexpr int E_DEFAULT_EXCEED_LENGTH_LIMIT = (E_BASE + 17);
129 
130 /**
131 * @brief The error code for permission denied.
132 */
133 constexpr int PERMISSION_DENIED = (E_BASE + 18);
134 
135 /**
136 * @brief Failed to get DataObsMgrClient.
137 */
138 static constexpr int E_GET_DATAOBSMGRCLIENT_FAIL = (E_BASE + 19);
139 
140 } // namespace NativePreferences
141 } // namespace OHOS
142 #endif // PREFERENCES_ERRNO_H
143