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 INTERFACES_KITS_NAPI_COMMON_INCLUDE_NAPI_ERROR_MSG_H
17 #define INTERFACES_KITS_NAPI_COMMON_INCLUDE_NAPI_ERROR_MSG_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace Security {
23 namespace DlpPermission {
24 enum JsErrorCode : int32_t {
25     ERR_JS_SUCCESS = 0,
26     ERR_JS_PERMISSION_DENIED = 201,
27     ERR_JS_NOT_SYSTEM_APP = 202,
28     ERR_JS_PARAMETER_ERROR = 401,
29     ERR_JS_CAPABILITY_NOT_SUPPORTED = 801,
30     ERR_JS_INVALID_PARAMETER = 19100001,
31     ERR_JS_BEGIN_CREDENTIAL_FAIL = 19100002,
32     ERR_JS_CREDENTIAL_TIMEOUT = 19100003,
33     ERR_JS_CREDENTIAL_SERVICE_ERROR = 19100004,
34     ERR_JS_CREDENTIAL_SERVER_ERROR = 19100005,
35     ERR_JS_API_ONLY_FOR_SANDBOX_ERROR = 19100006,
36     ERR_JS_API_NOT_FOR_SANDBOX_ERROR = 19100007,
37     ERR_JS_NOT_DLP_FILE = 19100008,
38     ERR_JS_OPERATE_DLP_FILE_FAIL = 19100009,
39     ERR_JS_DLP_FILE_READ_ONLY = 19100010,
40     ERR_JS_SYSTEM_SERVICE_EXCEPTION = 19100011,
41     ERR_JS_OUT_OF_MEMORY = 19100012,
42     ERR_JS_USER_NO_PERMISSION = 19100013,
43     ERR_JS_ACCOUNT_NOT_LOGIN = 19100014,
44     ERR_JS_SYSTEM_NEED_TO_BE_UPGRADED = 19100015,
45     ERR_JS_URI_NOT_EXIST = 19100016,
46     ERR_JS_PARAM_DISPLAY_NAME_NOT_EXIST = 19100017,
47     ERR_JS_APPLICATION_NOT_AUTHORIZED = 19100018,
48     ERR_JS_DLP_FILE_EXPIRE_TIME = 19100019,
49     ERR_JS_DLP_CREDENTIAL_NO_INTERNET_ERROR = 19100020,
50 };
51 
52 std::string GetJsErrMsg(int32_t errNo);
53 int32_t NativeCodeToJsCode(int32_t nativeErrCode);
54 }  // namespace DlpPermission
55 }  // namespace Security
56 }  // namespace OHOS
57 #endif /*  INTERFACES_KITS_NAPI_COMMON_INCLUDE_NAPI_ERROR_MSG_H */
58