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 INTERFACES_PRIVACY_KITS_NAPI_ERROR_H 17 #define INTERFACES_PRIVACY_KITS_NAPI_ERROR_H 18 #include "string" 19 #include "access_token.h" 20 #include "napi/native_api.h" 21 #include "napi/native_node_api.h" 22 23 namespace OHOS { 24 namespace Security { 25 namespace AccessToken { 26 typedef enum { 27 JS_OK = 0, 28 JS_ERROR_PERMISSION_DENIED = 201, 29 JS_ERROR_NOT_SYSTEM_APP = 202, 30 JS_ERROR_PARAM_ILLEGAL = 401, 31 JS_ERROR_SYSTEM_CAPABILITY_NOT_SUPPORT = 801, 32 JS_ERROR_PARAM_INVALID = 12100001, 33 JS_ERROR_TOKENID_NOT_EXIST, 34 JS_ERROR_PERMISSION_NOT_EXIST, 35 JS_ERROR_NOT_USE_TOGETHER, 36 JS_ERROR_REGISTERS_EXCEED_LIMITATION, 37 JS_ERROR_PERMISSION_OPERATION_NOT_ALLOWED, 38 JS_ERROR_SERVICE_NOT_RUNNING, 39 JS_ERROR_OUT_OF_MEMORY, 40 JS_ERROR_INNER, 41 } JsErrorCode; 42 43 std::string GetParamErrorMsg(const std::string& param, const std::string& type); 44 napi_value GenerateBusinessError(napi_env env, int32_t errCode, const std::string& errMsg); 45 std::string GetErrorMessage(uint32_t errCode); 46 napi_value GetNapiNull(napi_env env); 47 } // namespace AccessToken 48 } // namespace Security 49 } // namespace OHOS 50 #endif /* INTERFACES_PRIVACY_KITS_NAPI_ERROR_H */ 51 52