• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 UDMF_ERROR_CODE_H
17 #define UDMF_ERROR_CODE_H
18 
19 #include <cstdint>
20 #include <errors.h>
21 #include <map>
22 #include <string>
23 
24 namespace OHOS {
25 namespace UDMF {
26 enum UdmfModule {
27     UDMF_MODULE_SERVICE_ID = 0x07,
28 };
29 
30 // UDMF error offset, used only in this file.
31 constexpr ErrCode UDMF_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDDATAMNG, UDMF_MODULE_SERVICE_ID);
32 
33 enum Status : int32_t {
34     E_OK = ERR_OK,
35     E_ERROR,
36     E_WRITE_PARCEL_ERROR = UDMF_ERR_OFFSET,
37     E_READ_PARCEL_ERROR,
38     E_IPC,
39     E_NO_PERMISSION,
40     E_INVALID_PARAMETERS,
41     E_DB_ERROR,
42     E_FS_ERROR,
43     E_NOT_FOUND,
44     E_BUTT,
45 };
46 
47 static const std::unordered_map<int32_t, std::string> ERROR_MAP {
48     { Status::E_OK, "E_OK" },
49     { Status::E_ERROR, "E_ERROR" },
50     { Status::E_WRITE_PARCEL_ERROR, "E_WRITE_PARCEL_ERROR" },
51     { Status::E_READ_PARCEL_ERROR, "E_READ_PARCEL_ERROR" },
52     { Status::E_IPC, "E_IPC" },
53     { Status::E_NO_PERMISSION, "E_NO_PERMISSION" },
54     { Status::E_INVALID_PARAMETERS, "E_INVALID_PARAMETERS" },
55     { Status::E_DB_ERROR, "E_DB_ERROR" },
56     { Status::E_FS_ERROR, "E_FS_ERROR" },
57     { Status::E_NOT_FOUND, "E_NOT_FOUND" }
58 };
59 } // namespace UDMF
60 } // namespace OHOS
61 #endif // UDMF_ERROR_CODE_H