• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #ifndef SOFTBUS_NAPI_UTILS_H
16 #define SOFTBUS_NAPI_UTILS_H
17 #include "napi/native_api.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /* __cplusplus */
22 typedef enum {
23     COMMON_ACCESS_TOKEN_DENIED = 201,
24     COMMON_INVALID_PARAM = 401,
25 
26     NAPI_SOFTBUS_LINK_DISABLED = 32390001,
27     NAPI_SOFTBUS_DEVICE_NOT_PAIRED = 32390002,
28     NAPI_SOFTBUS_PROFILE_NOT_SUPPORT = 32390003,
29     NAPI_SOFTBUS_CHANNEL_UNAVAILABLE = 32390004,
30     NAPI_SOFTBUS_CHANNEL_REOPEN = 32390005,
31     NAPI_SOFTBUS_INVALID_PARAM = 32390006,
32     NAPI_SOFTBUS_INTERNAL_ERROR = 32390100,
33     NAPI_SOFTBUS_CALL_IS_RESTRICTED = 32390101,
34     NAPI_SOFTBUS_OPEN_OPERATION_FAILED = 32390102,
35     NAPI_SOFTBUS_DATA_TOO_LONG = 32390103,
36     NAPI_SOFTBUS_SEND_OPERATION_FAILED = 32390104,
37     NAPI_SOFTBUS_UNKNOWN_ERR = 30200000,
38 } SoftbusJsErrCode;
39 
40 void ThrowErrFromC2Js(napi_env env, int32_t ret);
41 napi_value GetBusinessError(napi_env env, int32_t errCode);
42 
43 #ifdef __cplusplus
44 }
45 #endif /* __cplusplus */
46 #endif // SOFTBUS_NAPI_UTILS_H