#include <internal/RequestHandler.h>
#include <internal/AssertUtils.h>
+
+#include <logger.h>
#include <OCPlatform.h>
namespace
{
using namespace OIC::Service;
+ constexpr const char LOG_TAG[]{ "PrimitiveServerResource" };
+
namespace Detail
{
template <typename RESPONSE>
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;
}
}
}
catch (...)
{
+ OC_LOG(WARNING, LOG_TAG, "Failed to unregister resource.");
}
}
}
}
catch (...)
{
+ OC_LOG(WARNING, LOG_TAG, "Failed to handle request.");
// TODO : how to notify the error?
}