diff --git a/foundations/model/include/call_result.h b/foundations/model/include/call_result.h index e32cff45a51a62ea85de29e22a838d642e88e908..ac5acda8fe665167cf30157c0d27bb4d95a88789 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 0a3a761cbe2347f2d30e54d1f0e7448f0125c4f7..cbdfd4fd0b6b2a446fb352c67c0089ff03fdf26b 100644 --- a/frameworks/js/napi/session/include/napi_session.h +++ b/frameworks/js/napi/session/include/napi_session.h @@ -100,7 +100,7 @@ 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_) + NOT_SYSTEM_APP_INFO.data(); 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 e7b8485358e4bde066258e7a071fc191e8fd61e8..f8dceac708852d48e86b49a72f0f970fbb596db0 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);