From a53752c419c8e20e0f28420a71af3c5e0638e042 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 19 Aug 2022 00:17:13 +0000 Subject: [PATCH] Add a missing exception handling The SetReceiveTimeout() method throws an exception when the error occurs. Change-Id: I8ea11f4d7e04a127efebe4c516a1fbe32bf6a435 Signed-off-by: Hwankyu Jhun --- src/proxy-internal.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/proxy-internal.cc b/src/proxy-internal.cc index 2eb538b..bd03cac 100644 --- a/src/proxy-internal.cc +++ b/src/proxy-internal.cc @@ -611,7 +611,7 @@ Proxy::Client* Proxy::Client::Create(Proxy* parent, std::unique_ptr 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(); } -- 2.7.4