Add a missing exception handling 80/279880/2
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 19 Aug 2022 00:17:13 +0000 (00:17 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 19 Aug 2022 00:58:39 +0000 (00:58 +0000)
The SetReceiveTimeout() method throws an exception when the error occurs.

Change-Id: I8ea11f4d7e04a127efebe4c516a1fbe32bf6a435
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/proxy-internal.cc

index 2eb538b..bd03cac 100644 (file)
@@ -611,7 +611,7 @@ Proxy::Client* Proxy::Client::Create(Proxy* parent,
   std::unique_ptr<Proxy::Client> client;
   try {
     client.reset(new (std::nothrow) Proxy::Client(parent));
-  } catch (Exception& e) {
+  } catch (const Exception& e) {
     _E("Exception(%s) occurs", e.what());
     return nullptr;
   }
@@ -634,7 +634,13 @@ Proxy::Client* Proxy::Client::Create(Proxy* parent,
     return nullptr;
   }
 
-  client->SetReceiveTimeout(5000);
+  try {
+    client->SetReceiveTimeout(5000);
+  } catch (const Exception& e) {
+    _E("Exception occurs. error(%s)", e.what());
+    return nullptr;
+  }
+
   _W("endpoint(%s), fd(%d)", endpoint.c_str(), client->GetFd());
   return client.release();
 }