From 9f550db47a6fdd0e27e35fe1c15a3cb5bd07b00d Mon Sep 17 00:00:00 2001 From: linan24 Date: Thu, 4 Sep 2025 16:30:55 +0800 Subject: [PATCH] add exception catch Signed-off-by: linan24 --- services/backup_sa/src/module_ipc/sub_service.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/backup_sa/src/module_ipc/sub_service.cpp b/services/backup_sa/src/module_ipc/sub_service.cpp index 51a6b972b..da71f1b81 100644 --- a/services/backup_sa/src/module_ipc/sub_service.cpp +++ b/services/backup_sa/src/module_ipc/sub_service.cpp @@ -1399,7 +1399,12 @@ ErrCode Service::TryToConnectExt(const std::string& bundleName, sptrSetCallback(callConnected); extConnection->SetCallDied(callDied); - AAFwk::Want want = CreateConnectWant(bundleName); + AAFwk::Want want; + try { + want = CreateConnectWant(bundleName); + } catch (const BError &e) { + return e.GetCode(); + } ErrCode err = extConnection->ConnectBackupExtAbility(want, GetUserIdDefault(), false); if (err != BError(BError::Codes::OK)) { HILOGE("ConnectBackupExtAbility failed, bundleName:%{public}s, ret:%{public}d", bundleName.c_str(), err); -- Gitee