From bbb5e41b507872d5bccddaaba5c7ab2bb7f69da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 30 Jul 2024 11:16:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9202=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=A0=81=E8=8B=B1=E6=96=87=E4=BF=A1=E6=81=AF=20Signed-off-by:?= =?UTF-8?q?=20=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/js/napi/session/include/napi_session.h | 3 ++- frameworks/js/napi/session/src/napi_common_utils.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/js/napi/session/include/napi_session.h b/frameworks/js/napi/session/include/napi_session.h index 0a3a761c..6fa609a6 100644 --- a/frameworks/js/napi/session/include/napi_session.h +++ b/frameworks/js/napi/session/include/napi_session.h @@ -100,7 +100,8 @@ protected: std::string permissionName; switch (workResult_) { case INT_NOT_SYSTEM_APP: - msg = "BusinessError " + std::to_string(workResult_) + ": Caller not system app."; + msg = "BusinessError " + std::to_string(workResult_) + + ": Permission verification failed. A non-system application calls a system API."; break; case INT_APP_NOT_GRANTED: GetSessionFuncParameter(funcName, permissionName); diff --git a/frameworks/js/napi/session/src/napi_common_utils.cpp b/frameworks/js/napi/session/src/napi_common_utils.cpp index e7b84853..f8dceac7 100644 --- a/frameworks/js/napi/session/src/napi_common_utils.cpp +++ b/frameworks/js/napi/session/src/napi_common_utils.cpp @@ -225,7 +225,8 @@ void NapiCommonUtils::NapiThrowNotSystemAppError(napi_env env) { BusinessError businessError; CallResult errCode = CallResult::NOT_SYSTEM_APP; - std::string errMsg = "BusinessError " + std::to_string(CAST_INT(errCode)).append(": Caller not system app."); + std::string errMsg = "BusinessError " + std::to_string(CAST_INT(errCode)) + .append(": Permission verification failed. A non-system application calls a system API."); businessError.Build(errCode, errMsg); napi_value msg = BuildThrowError(env, businessError); napi_status status = napi_throw(env, msg); -- Gitee From 63f8b124b24162c1dd23d58ff4aa95f28fdef5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 30 Jul 2024 06:36:34 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E8=B6=8550=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- foundations/model/include/call_result.h | 2 ++ frameworks/js/napi/session/include/napi_session.h | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/foundations/model/include/call_result.h b/foundations/model/include/call_result.h index e32cff45..ac5acda8 100644 --- a/foundations/model/include/call_result.h +++ b/foundations/model/include/call_result.h @@ -53,5 +53,7 @@ constexpr int32_t INT_TIME_OUT = CAST_INT(CallResult::TIME_OUT); constexpr int32_t INT_DB_ERROR = CAST_INT(CallResult::DB_ERROR); constexpr int32_t INT_IO_ERROR = CAST_INT(CallResult::IO_ERROR); constexpr int32_t INT_NET_ERROR = CAST_INT(CallResult::NET_ERROR); +constexpr std::string_view NOT_SYSTEM_APP_INFO = + ": Permission verification failed. A non-system application calls a system API."; } // namespace OHOS::UpdateEngine #endif // UPDATE_SERVICE_CALL_RESULT_H diff --git a/frameworks/js/napi/session/include/napi_session.h b/frameworks/js/napi/session/include/napi_session.h index 6fa609a6..cbdfd4fd 100644 --- a/frameworks/js/napi/session/include/napi_session.h +++ b/frameworks/js/napi/session/include/napi_session.h @@ -100,8 +100,7 @@ protected: std::string permissionName; switch (workResult_) { case INT_NOT_SYSTEM_APP: - msg = "BusinessError " + std::to_string(workResult_) + - ": Permission verification failed. A non-system application calls a system API."; + msg = "BusinessError " + std::to_string(workResult_) + NOT_SYSTEM_APP_INFO.data(); break; case INT_APP_NOT_GRANTED: GetSessionFuncParameter(funcName, permissionName); -- Gitee