• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OHOS_ABILITY_RUNTIME_QUICK_FIX_ERROR_UTILS_H
17 #define OHOS_ABILITY_RUNTIME_QUICK_FIX_ERROR_UTILS_H
18 
19 #include <cstdint>
20 #include <string>
21 
22 namespace OHOS {
23 namespace AAFwk {
24 enum {
25     QUICK_FIX_OK = 0,
26     QUICK_FIX_WRITE_PARCEL_FAILED = 1,
27     QUICK_FIX_READ_PARCEL_FAILED = 2,
28     QUICK_FIX_SEND_REQUEST_FAILED = 3,
29     QUICK_FIX_COPY_FILES_FAILED = 4,
30     QUICK_FIX_INVALID_PARAM = 5,
31     QUICK_FIX_CONNECT_FAILED = 6,
32     QUICK_FIX_VERIFY_PERMISSION_FAILED = 7,
33     QUICK_FIX_GET_BUNDLE_INFO_FAILED = 8,
34     QUICK_FIX_DEPLOY_FAILED = 9,
35     QUICK_FIX_SWICH_FAILED = 10,
36     QUICK_FIX_DELETE_FAILED = 11,
37     QUICK_FIX_NOTIFY_LOAD_PATCH_FAILED = 12,
38     QUICK_FIX_NOTIFY_RELOAD_PAGE_FAILED = 13,
39     QUICK_FIX_REGISTER_OBSERVER_FAILED = 14,
40     QUICK_FIX_APPMGR_INVALID = 15,
41     QUICK_FIX_BUNDLEMGR_INVALID = 16,
42     QUICK_FIX_SET_INFO_FAILED = 17,
43     QUICK_FIX_PROCESS_TIMEOUT = 18,
44     QUICK_FIX_NOTIFY_UNLOAD_PATCH_FAILED = 19,
45 };
46 
47 enum {
48     // success
49     ERR_OK = 0,
50 
51     // The application does not have permission to call the interface.
52     ERR_QUICKFIX_PERMISSION_DENIED = 201,
53 
54     // Invalid input parameter.
55     ERR_QUICKFIX_PARAM_INVALID = 401,
56 
57     // The bundle is not exist.
58     ERR_QUICKFIX_BUNDLE_NAME_INVALID = 18500001,
59 
60     // Copy hqf file failed, maybe not exist or inaccessible.
61     ERR_QUICKFIX_HQF_INVALID = 18500002,
62 
63     // Deploy hqf file failed.
64     ERR_QUICKFIX_HQF_DEPLOY_FAILED = 18500003,
65 
66     // Switch hqf file failed.
67     ERR_QUICKFIX_HQF_SWITCH_FAILED = 18500004,
68 
69     // Delete hqf file failed.
70     ERR_QUICKFIX_HQF_DELETE_FAILED = 18500005,
71 
72     // Load patch failed.
73     ERR_QUICKFIX_LOAD_PATCH_FAILED = 18500006,
74 
75     // Unload patch failed.
76     ERR_QUICKFIX_UNLOAD_PATCH_FAILED = 18500007,
77 
78     // Internal error.
79     ERR_QUICKFIX_INTERNAL_ERROR = 18500008,
80 };
81 
82 class QuickFixErrorUtil {
83 public:
84     static int32_t GetErrorCode(int32_t internalErrCode);
85     static std::string GetErrorMessage(int32_t internalErrCode);
86 };
87 } // namespace AAFwk
88 } // namespace OHOS
89 #endif // OHOS_ABILITY_RUNTIME_QUICK_FIX_ERROR_UTILS_H
90