diff --git a/frameworks/js/napi/vibrator/src/vibrator_js.cpp b/frameworks/js/napi/vibrator/src/vibrator_js.cpp index 9b5b707ab13f56ec6c484dc3acc8e9e87b311ddb..82efe49aefe2f19952279e1915cabee8ee2f88e7 100644 --- a/frameworks/js/napi/vibrator/src/vibrator_js.cpp +++ b/frameworks/js/napi/vibrator/src/vibrator_js.cpp @@ -675,7 +675,12 @@ static napi_value IsSupportEffect(napi_env env, napi_callback_info info) sptr asyncCallbackInfo = new (std::nothrow) AsyncCallbackInfo(env); CHKPP(asyncCallbackInfo); asyncCallbackInfo->callbackType = IS_SUPPORT_EFFECT_CALLBACK; - asyncCallbackInfo->error.code = IsSupportEffect(effectId.c_str(), &asyncCallbackInfo->isSupportEffect); + bool isSupportEffect = false; + int32_t ret = IsSupportEffect(effectId.c_str(), &isSupportEffect); + if (ret == PERMISSION_DENIED || ret == PARAMETER_ERROR) { + asyncCallbackInfo->error.code = ret; + } + asyncCallbackInfo->isSupportEffect = isSupportEffect; if ((argc > 1) && (IsMatchType(env, args[1], napi_function))) { return EmitAsyncWork(args[1], asyncCallbackInfo); }