From ce27c7e6104cbda686e9f6dc6e2776fc5e1a029e Mon Sep 17 00:00:00 2001 From: shenpeixing Date: Mon, 8 Sep 2025 14:51:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9C=87=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E6=97=A0=E6=9D=83=E9=99=90=E6=9C=AA=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shenpeixing --- .../ets/taihe/author/src/ohos.vibrator.impl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp b/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp index 8d294e9..314ca73 100644 --- a/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp +++ b/frameworks/ets/taihe/author/src/ohos.vibrator.impl.cpp @@ -78,7 +78,11 @@ struct VibrateInfo { void stopVibrationByModeSync(::ohos::vibrator::VibratorStopMode stopMode) { CALL_LOG_ENTER; - StopVibrator(stopMode.get_value()); + int32_t ret = StopVibrator(stopMode.get_value()); + if (ret != SUCCESS) { + taihe::set_business_error(ret, "stop vibrator by mode failed"); + return; + } } static bool ParseVibratorCurvePoint(::taihe::array<::ohos::vibrator::VibratorCurvePoint> pointsArray, uint32_t index, @@ -404,7 +408,7 @@ void startVibrationSync(::ohos::vibrator::VibrateEffect const& effect, } int32_t ret = PlayPrimitiveEffect(vibrateInfo.effectId.c_str(), vibrateInfo.intensity); if (ret != SUCCESS) { - taihe::set_business_error(PARAMETER_ERROR, "start vibrator failed"); + taihe::set_business_error(ret, "start vibrator failed"); return; } } else { @@ -412,8 +416,8 @@ void startVibrationSync(::ohos::vibrator::VibrateEffect const& effect, if (vibrateInfo.vibratorPattern.events != nullptr) { CHKCV(ClearVibratorPattern(vibrateInfo.vibratorPattern), "ClearVibratorPattern fail"); } - if (ret == PARAMETER_ERROR) { - taihe::set_business_error(PARAMETER_ERROR, "Parameters invalid"); + if (ret != SUCCESS) { + taihe::set_business_error(ret, "start vibrator failed"); return; } } -- Gitee