Return accurate error codes for error cases. 21/211021/3
authorSenthil Kumar G S <senthil.gs@samsung.com>
Wed, 17 Jul 2019 07:33:32 +0000 (13:03 +0530)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 1 Aug 2019 23:11:22 +0000 (08:11 +0900)
1. Returning CA_MEMORY_ALLOC_FAILED instead of CA_STATUS_FAILED.
2. If request doesn't contain RequestURI/Proxy URI, then return OC_STACK_INVALID_URI.

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/545/commits/a2e9bce4cc70b63f9a82cce82970167126794e9a
(cherry-picked from ac207215d4c4550ad89c9b72ab81b859a83a0c2b)

Change-Id: Ib5f2b05dbc621ee8cc70ae9760a70b44a8c476f8
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
Signed-off-by: Sudipto Bal <sudipto.bal@samsung.com>
resource/csdk/connectivity/src/camessagehandler.c
resource/csdk/stack/src/ocstack.c

index 638610e..41b8884 100644 (file)
@@ -1111,7 +1111,7 @@ CAResult_t CADetachSendNetworkReqMessage(const CAEndpoint_t *endpoint,
     if (!cadata)
     {
         OIC_LOG(ERROR, TAG, "cadata memory allocation failed");
-        return CA_STATUS_FAILED;
+        return CA_MEMORY_ALLOC_FAILED;
     }
 
     CAEndpoint_t* ep = CACloneEndpoint(endpoint);
@@ -1119,7 +1119,7 @@ CAResult_t CADetachSendNetworkReqMessage(const CAEndpoint_t *endpoint,
     {
         OIC_LOG(ERROR, TAG, "endpoint clone failed");
         OICFree(cadata);
-        return CA_STATUS_FAILED;
+        return CA_MEMORY_ALLOC_FAILED;
     }
 
     cadata->remoteEndpoint = ep;
index 086567e..ce79291 100644 (file)
@@ -2969,6 +2969,7 @@ OCStackResult OCDoRequest(OCDoHandle *handle,
     }
     else if (!checkProxyUri(options, numOptions))
     {
+        result = OC_STACK_INVALID_URI;
         OIC_LOG(ERROR, TAG, "Request doesn't contain RequestURI/Proxy URI");
         goto exit;
     }