1 /* 2 * Copyright (c) 2022-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 16 #ifndef HIAPPEVENT_FRAMEWORKS_JS_NAPI_INCLUDE_NAPI_ERROR_H 17 #define HIAPPEVENT_FRAMEWORKS_JS_NAPI_INCLUDE_NAPI_ERROR_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace HiviewDFX { 23 namespace NapiError { 24 constexpr int ERR_OK = 0; 25 // common api error 26 constexpr int ERR_PARAM = 401; 27 28 // business error of write function 29 constexpr int ERR_DISABLE = 11100001; 30 constexpr int ERR_INVALID_DOMAIN = 11101001; 31 constexpr int ERR_INVALID_NAME = 11101002; 32 constexpr int ERR_INVALID_PARAM_NUM = 11101003; 33 constexpr int ERR_INVALID_STR_LEN = 11101004; 34 constexpr int ERR_INVALID_KEY = 11101005; 35 constexpr int ERR_INVALID_ARR_LEN = 11101006; 36 constexpr int ERR_INVALID_CUSTOM_PARAM_NUM = 11101007; 37 38 // business error of addWatcher function 39 constexpr int ERR_INVALID_WATCHER_NAME = 11102001; 40 constexpr int ERR_INVALID_FILTER_DOMAIN = 11102002; 41 constexpr int ERR_INVALID_COND_ROW = 11102003; 42 constexpr int ERR_INVALID_COND_SIZE = 11102004; 43 constexpr int ERR_INVALID_COND_TIMEOUT = 11102005; 44 45 // business error of configure function 46 constexpr int ERR_INVALID_MAX_STORAGE = 11103001; 47 48 // business error of AppEventPackageHolder.setSize function 49 constexpr int ERR_INVALID_SIZE = 11104001; 50 51 // business error for incorrect parameter length or format 52 constexpr int ERR_INVALID_PARAM_VALUE = 11105001; 53 54 std::string GetErrorMsg(int errCode); 55 } // namespace NapiError 56 } // namespace HiviewDFX 57 } // namespace OHOS 58 #endif // HIAPPEVENT_FRAMEWORKS_JS_NAPI_INCLUDE_NAPI_ERROR_H