summaryrefslogtreecommitdiff
path: root/installer/src
diff options
context:
space:
mode:
authorIlho Kim <ilho159.kim@samsung.com>2024-04-11 17:45:56 +0900
committerIlho Kim <ilho159.kim@samsung.com>2024-04-11 18:18:38 +0900
commit015dd3cd87cb07a074acbeacf73138c248dd2195 (patch)
tree77a3905866ceb44cc78119d6a49e932f938c01a6 /installer/src
parent7d57137fda1d6a53d250447a47eb093d9c45e9d0 (diff)
downloadslp-pkgmgr-015dd3cd87cb07a074acbeacf73138c248dd2195.tar.gz
slp-pkgmgr-015dd3cd87cb07a074acbeacf73138c248dd2195.tar.bz2
slp-pkgmgr-015dd3cd87cb07a074acbeacf73138c248dd2195.zip
Apply try-catch where exception can be occured
Change-Id: Ic4fc7bcea0ce79a68afe97607bd66c821b87a6c0 Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
Diffstat (limited to 'installer/src')
-rw-r--r--installer/src/control.cc33
-rw-r--r--installer/src/request.hh2
2 files changed, 25 insertions, 10 deletions
diff --git a/installer/src/control.cc b/installer/src/control.cc
index 8c0e8f0..e9f6d30 100644
--- a/installer/src/control.cc
+++ b/installer/src/control.cc
@@ -386,9 +386,15 @@ int Control::SendSignal(std::string pkg_type, std::string pkgid,
auto& req = GetRequest();
std::vector<rpc_port::PkgSignal::PkgInfo> pkgs;
pkgs.emplace_back(std::move(pkgid), std::move(appid), std::move(pkg_type));
- signal_->AsyncResult("", req->GetUid(), req->GetSessionId(), std::move(pkgs),
- key, val);
- return 0;
+
+ try {
+ signal_->AsyncResult("", req->GetUid(), req->GetSessionId(), std::move(pkgs),
+ key, val);
+ return 0;
+ } catch (...) {
+ _E("Exception occured");
+ return -1;
+ }
}
int Control::SendSignals(std::string key, std::string val) {
@@ -397,8 +403,14 @@ int Control::SendSignals(std::string key, std::string val) {
return -1;
}
auto& req = GetRequest();
- signal_->AsyncResult("", req->GetUid(), req->GetSessionId(), pkgs_, key, val);
- return 0;
+
+ try {
+ signal_->AsyncResult("", req->GetUid(), req->GetSessionId(), pkgs_, key, val);
+ return 0;
+ } catch (...) {
+ _E("Exception occured");
+ return -1;
+ }
}
int Control::SendSignalForResource(std::string pkgid, std::string status,
@@ -415,9 +427,14 @@ int Control::SendSignalForResource(std::string pkgid, std::string status,
return -1;
}
- signal_->AsyncResultForResource(signal_name, req->GetUid(),
- req->GetSessionId(), std::move(pkgid), std::move(status), *event_info);
- return 0;
+ try {
+ signal_->AsyncResultForResource(signal_name, req->GetUid(),
+ req->GetSessionId(), std::move(pkgid), std::move(status), *event_info);
+ return 0;
+ } catch (...) {
+ _E("Exception occured");
+ return -1;
+ }
}
static int __send_signal_to_agent(uid_t uid, void* data, size_t len) {
diff --git a/installer/src/request.hh b/installer/src/request.hh
index d8e49ad..d9c48d0 100644
--- a/installer/src/request.hh
+++ b/installer/src/request.hh
@@ -24,8 +24,6 @@
#include <list>
#include <vector>
-#include "PkgSignal.h"
-
namespace pkgmgr {
namespace installer {