1  /*
2   * Copyright (c) 2021 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 NAPI_HISYSEVENT_RET_DEF_H
17  #define NAPI_HISYSEVENT_RET_DEF_H
18  
19  namespace OHOS {
20  namespace HiviewDFX {
21  namespace NapiError {
22  // common api error
23  constexpr int32_t ERR_PERMISSION_CHECK = 201;
24  constexpr int32_t ERR_NON_SYS_APP_PERMISSION = 202;
25  constexpr int32_t ERR_PARAM_CHECK = 401;
26  
27  constexpr int32_t ERR_UNKNOWN = 11200000;
28  
29  // business error of write function
30  constexpr int32_t ERR_INVALID_DOMAIN = 11200001;
31  constexpr int32_t ERR_INVALID_EVENT_NAME = 11200002;
32  constexpr int32_t ERR_ENV_ABNORMAL = 11200003;
33  constexpr int32_t ERR_CONTENT_OVER_LIMIT = 11200004;
34  constexpr int32_t ERR_INVALID_PARAM_NAME = 11200051;
35  constexpr int32_t ERR_STR_LEN_OVER_LIMIT = 11200052;
36  constexpr int32_t ERR_PARAM_COUNT_OVER_LIMIT = 11200053;
37  constexpr int32_t ERR_ARRAY_SIZE_OVER_LIMIT = 11200054;
38  
39  // business error of addWatcher function
40  constexpr int32_t ERR_WATCHER_COUNT_OVER_LIMIT = 11200101;
41  constexpr int32_t ERR_WATCH_RULE_COUNT_OVER_LIMIT = 11200102;
42  
43  // business error of removeWatcher function
44  constexpr int32_t ERR_WATCHER_NOT_EXIST = 11200201;
45  
46  // business error of query function
47  constexpr int32_t ERR_QUERY_RULE_COUNT_OVER_LIMIT = 11200301;
48  constexpr int32_t ERR_INVALID_QUERY_RULE = 11200302;
49  constexpr int32_t ERR_CONCURRENT_QUERY_COUNT_OVER_LIMIT = 11200303;
50  constexpr int32_t ERR_QUERY_TOO_FREQUENTLY = 11200304;
51  constexpr int32_t ERR_REMOVE_SUBSCRIBE = 11200305;
52  }
53  
54  namespace NapiInnerError {
55  constexpr int32_t ERR_INVALID_DOMAIN_IN_QUERY_RULE = 112003001;
56  constexpr int32_t ERR_INVALID_EVENT_NAME_IN_QUERY_RULE = 112003002;
57  }
58  
59  static constexpr int32_t NAPI_SUCCESS = 0;
60  
61  static constexpr int32_t ERR_INVALID_PARAM_COUNT = -100;
62  static constexpr int32_t ERR_NAPI_PARSED_FAILED = -101;
63  static constexpr int32_t ERR_LISTENER_RULES_TYPE_NOT_ARRAY = -102;
64  static constexpr int32_t ERR_LISTENER_RULE_TYPE_INVALID = -103;
65  static constexpr int32_t ERR_QUERY_ARG_TYPE_INVALID = -104;
66  static constexpr int32_t ERR_QUERY_RULES_TYPE_NOT_ARRAY = -105;
67  static constexpr int32_t ERR_QUERY_RULE_TYPE_INVALID = -106;
68  static constexpr int32_t ERR_NAPI_LISTENER_NOT_FOUND = -107;
69  } // namespace HiviewDFX
70  } // namespace OHOS
71  
72  #endif // NAPI_HISYSEVENT_RET_DEF_H
73  
74