1/* 2 * Copyright (c) 2024 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 WINDOW_WINDOW_MANAGER_JS_ERROR_UTILS_H 17#define WINDOW_WINDOW_MANAGER_JS_ERROR_UTILS_H 18 19#include "native_engine/native_engine.h" 20#include "native_engine/native_value.h" 21 22#include "dm_common.h" 23#include "wm_common.h" 24 25namespace OHOS::Rosen { 26class JsErrUtils { 27public: 28 static inline napi_value CreateJsError(napi_env env, const WMError& errorCode, std::string msg = "") 29 { 30 return nullptr; 31 } 32 33 static inline napi_value CreateJsError(napi_env env, const WmErrorCode& errorCode, std::string msg = "") 34 { 35 return nullptr; 36 } 37 38 static inline napi_value CreateJsError(napi_env env, const DMError& errorCode, std::string msg = "") 39 { 40 return nullptr; 41 } 42 43 static inline napi_value CreateJsError(napi_env env, const DmErrorCode& errorCode, std::string msg = "") 44 { 45 return nullptr; 46 } 47private: 48 static inline napi_value CreateJsNumber(napi_env env, int32_t value) 49 { 50 return nullptr; 51 } 52 53 static inline napi_value CreateJsNumber(napi_env env, uint32_t value) 54 { 55 return nullptr; 56 } 57 58 static inline napi_value CreateJsNumber(napi_env env, int64_t value) 59 { 60 return nullptr; 61 } 62 63 static inline napi_value CreateJsNumber(napi_env env, double value) 64 { 65 return nullptr; 66 } 67 68 template<class T> 69 static napi_value CreateJsValue(napi_env env, const T& value) 70 { 71 return nullptr; 72 } 73 74 static std::string GetErrorMsg(const WMError& errorCode) 75 { 76 return ""; 77 } 78 79 static std::string GetErrorMsg(const WmErrorCode& errorCode) 80 { 81 return ""; 82 } 83 84 static std::string GetErrorMsg(const DMError& errorCode) 85 { 86 return ""; 87 } 88 89 static std::string GetErrorMsg(const DmErrorCode& errorCode) 90 { 91 return ""; 92 } 93}; 94} // namespace OHOS::Rosen 95 96#endif //WINDOW_WINDOW_MANAGER_JS_ERROR_UTILS_H