int main(int argc, char** argv) {
ci::PkgmgrInstaller pkgmgr_installer;
wgt::WgtAppQueryInterface query_interface;
- auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer,
- &query_interface);
- if (!pkgmgr) {
- LOG(ERROR) << "Options of pkgmgr installer cannot be parsed";
- return EINVAL;
- }
+ try {
+ auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer,
+ &query_interface);
+ if (!pkgmgr) {
+ LOG(ERROR) << "Options of pkgmgr installer cannot be parsed";
+ return EINVAL;
+ }
- // This is workaround for hybrid apps as they requires much different flow
- // but installer does not branch at all in current design
- if (query_interface.IsHybridApplication(
- pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) {
- LOG(INFO) << "Hybrid package detected";
- hybrid::HybridInstaller installer(pkgmgr);
- return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
- } else {
- wgt::WgtInstaller installer(pkgmgr);
- return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
+ // This is workaround for hybrid apps as they requires much different flow
+ // but installer does not branch at all in current design
+ if (query_interface.IsHybridApplication(
+ pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) {
+ LOG(INFO) << "Hybrid package detected";
+ hybrid::HybridInstaller installer(pkgmgr);
+ return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
+ } else {
+ wgt::WgtInstaller installer(pkgmgr);
+ return (installer.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
+ }
+ } catch (...) {
+ LOG(ERROR) << "Exception occured";
+ return 1;
}
}