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 #ifndef ERROR_UTIL_H 16 #define ERROR_UTIL_H 17 18 #include <string> 19 20 #include "napi/native_api.h" 21 #include "napi/native_node_api.h" 22 23 namespace OHOS { 24 namespace Global { 25 namespace I18n { 26 // Common error code 27 const int32_t I18N_NO_PERMISSION = 201; // The app don't have requested permission 28 const int32_t I18N_NOT_FOUND = 401; // Input parameter is missing 29 30 // I18N error code 31 const int32_t I18N_NOT_VALID = 890001; // Unspported para value 32 const int32_t I18N_OPTION_NOT_VALID = 890002; // Unspported option value 33 34 class ErrorUtil { 35 public: 36 static void NapiThrow(napi_env env, int32_t errCode, bool throwError); 37 }; 38 } // namespace I18n 39 } // namespace Global 40 } // namespace OHOS 41 #endif