Handling uncaught exception 11/187311/4
authorhyunho <hhstark.kang@samsung.com>
Wed, 22 Aug 2018 02:11:09 +0000 (11:11 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Wed, 22 Aug 2018 05:05:53 +0000 (05:05 +0000)
Change-Id: Iaf8e2301666dfbe4b3602c692eb246932515ded8
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watchface-complication/complication.cc

index 9b5d521..8273209 100644 (file)
@@ -84,8 +84,13 @@ Complication::Impl::Impl(Complication* parent, int id,
 
 Complication::Impl::~Impl() {
   LOGI("complication destroy %d", complication_id_);
-  if (subscribe_id_ > 0)
-    ComplicationConnector::GetInst().UnSubscribeSignal(subscribe_id_);
+  if (subscribe_id_ > 0) {
+    try {
+      ComplicationConnector::GetInst().UnSubscribeSignal(subscribe_id_);
+    } catch (Exception &ex) {
+      LOGE("%s %d", ex.what(), ex.GetErrorCode());
+    }
+  }
 
   if (periodic_timer_)
     g_source_remove(periodic_timer_);
@@ -596,7 +601,13 @@ int Complication::SetCurDataIdx(int cur_data_idx) {
   LOGI("cur idx %d, cur provider %s, cur type %d", impl_->cur_data_idx_,
     impl_->cur_provider_id_.c_str(), impl_->cur_type_);
 
-  ComplicationConnector::GetInst().UnSubscribeSignal(impl_->subscribe_id_);
+  try {
+    ComplicationConnector::GetInst().UnSubscribeSignal(impl_->subscribe_id_);
+  } catch (Exception &ex) {
+    LOGE("%s %d", ex.what(), ex.GetErrorCode());
+    return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+  }
+
   if (impl_->cur_type_ == NoData) {
     impl_->subscribe_id_ = -1;
   } else {