From 35df719facb0f92ff460aa8eaa5be3b2650a9ce4 Mon Sep 17 00:00:00 2001 From: coderhyme Date: Tue, 23 Jun 2015 17:13:39 +0900 Subject: [PATCH] Add logs to where exceptions are swallowed Change-Id: Iacd2b4fcab6f2bf453c32264b853ad410e221900 Signed-off-by: coderhyme Reviewed-on: https://gerrit.iotivity.org/gerrit/1396 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- .../serverBuilder/src/PrimitiveServerResource.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/service/basis/serverBuilder/src/PrimitiveServerResource.cpp b/service/basis/serverBuilder/src/PrimitiveServerResource.cpp index dc43b3b..1201468 100644 --- a/service/basis/serverBuilder/src/PrimitiveServerResource.cpp +++ b/service/basis/serverBuilder/src/PrimitiveServerResource.cpp @@ -27,12 +27,16 @@ #include #include + +#include #include namespace { using namespace OIC::Service; + constexpr const char LOG_TAG[]{ "PrimitiveServerResource" }; + namespace Detail { template @@ -45,10 +49,18 @@ namespace ocResponse->setRequestHandle(ocRequest->getRequestHandle()); ocResponse->setResourceHandle(ocRequest->getResourceHandle()); - if (OC::OCPlatform::sendResponse(ocResponse) == OC_STACK_OK) + try + { + if (OC::OCPlatform::sendResponse(ocResponse) == OC_STACK_OK) + { + return OC_EH_OK; + } + } + catch (const OC::OCException& e) { - return OC_EH_OK; + OC_LOG(WARNING, LOG_TAG, e.what()); } + return OC_EH_ERROR; } } @@ -169,6 +181,7 @@ namespace OIC } catch (...) { + OC_LOG(WARNING, LOG_TAG, "Failed to unregister resource."); } } } @@ -246,6 +259,7 @@ namespace OIC } catch (...) { + OC_LOG(WARNING, LOG_TAG, "Failed to handle request."); // TODO : how to notify the error? } -- 2.7.4