Skip to content

Commit

Permalink
Fix: Modifying Error Codes in rbus_getExt API (#202)
Browse files Browse the repository at this point in the history
* Fix: Modifying Error Codes in RBUS Core

Reason for change: When an object not found error originates from rtrouted,
                   rbuscore retrus error code RBUSCORE_ERROR_ENTRY_NOT_FOUND instead of RBUSCORE_ERROR_DESTINATION_UNREACHABLE.
Signed-off-by: Netaji Panigrahi <[email protected]>

* Fix: Modifying Error Codes in RBUS Core

Reason for change: When an object not found error originates from rtrouted,
                   rbuscore retrus error code RBUSCORE_ERROR_ENTRY_NOT_FOUND instead of RBUSCORE_ERROR_DESTINATION_UNREACHABLE.
Signed-off-by: Netaji Panigrahi <[email protected]>

* Updated test code

* Fixed Method_Invoke failed tests

* Fixed SetMulti test

* Fix: Modifying Error Codes in rbus_getExt API
Reason for change: When Discover component names failed, rbusgetExt function will return the error code RBUSCORE_ERROR_ENTRY_NOT_FOUND.
Signed-off-by: Netaji Panigrahi <[email protected]>

* Fix: Modifying Error Codes
  • Loading branch information
NetajiPanigrahi authored and karuna2git committed Apr 15, 2024
1 parent a80377b commit b510906
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/rbus/rbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ static int _master_event_callback_handler(char const* sender, char const* eventN
if(subInternal->dirty)
{
errorcode = _rbus_event_unsubscribe(handleInfo, subInternal);
if(errorcode != RBUS_ERROR_DESTINATION_NOT_REACHABLE)
if(errorcode != RBUS_ERROR_DESTINATION_NOT_FOUND)
{
rbusEventSubscriptionInternal_free(subInternal);
errorcode = RBUS_ERROR_SUCCESS;
Expand Down Expand Up @@ -2995,7 +2995,7 @@ rbusError_t rbus_close(rbusHandle_t handle)
rbusEventSubscriptionInternal_t* subInternal = NULL;
subInternal = (rbusEventSubscriptionInternal_t*)rtVector_At(handleInfo->eventSubs, 0);
ret = _rbus_event_unsubscribe(handle, subInternal);
if (ret == RBUS_ERROR_DESTINATION_NOT_REACHABLE)
if (ret == RBUS_ERROR_DESTINATION_NOT_FOUND)
{
rtVector_RemoveItem(handleInfo->eventSubs, subInternal, rbusEventSubscriptionInternal_free);
}
Expand Down Expand Up @@ -3664,7 +3664,7 @@ rbusError_t rbus_getExt(rbusHandle_t handle, int paramCount, char const** pParam
}
else
{
errorcode = RBUS_ERROR_DESTINATION_NOT_REACHABLE;
errorcode = RBUS_ERROR_DESTINATION_NOT_FOUND;
RBUSLOG_ERROR("Discover component names failed with error %d and counts %d/%d", errorcode, paramCount, numComponents);
}
if(componentNames)
Expand Down Expand Up @@ -4623,7 +4623,7 @@ static rbusError_t _rbus_event_unsubscribe(
subInternal->dirty = true;
RBUSLOG_DEBUG ("n%s unsubscription failed because no provider could be found"
"and subscriber marked as dirty", subscription->eventName);
errorcode = RBUS_ERROR_DESTINATION_NOT_REACHABLE;
errorcode = RBUS_ERROR_DESTINATION_NOT_FOUND;
}
else
{
Expand Down Expand Up @@ -4860,7 +4860,7 @@ static void _subscribe_rawdata_handler(rbusHandle_t handle, rbusMessage_t* msg,
if (subInternal && subInternal->dirty)
{
errorcode = _rbus_event_unsubscribe(handle, subInternal);
if(errorcode == RBUS_ERROR_DESTINATION_NOT_REACHABLE)
if(errorcode == RBUS_ERROR_DESTINATION_NOT_FOUND)
{
RBUSLOG_DEBUG ("%s unsubscription failed because no provider could be found"
"and subscriber marked as dirty", subInternal->sub->eventName);
Expand Down Expand Up @@ -5096,7 +5096,7 @@ rbusError_t rbusEvent_UnsubscribeRawData(
if (subInternal)
{
errorcode = _rbus_event_unsubscribe(handle, subInternal);
if(errorcode != RBUS_ERROR_DESTINATION_NOT_REACHABLE)
if(errorcode != RBUS_ERROR_DESTINATION_NOT_FOUND)
{
rbusEventSubscriptionInternal_free(subInternal);
}
Expand Down Expand Up @@ -5326,7 +5326,7 @@ rbusError_t rbusEvent_UnsubscribeExRawData(
if(subInternal)
{
errorcode = _rbus_event_unsubscribe(handle, subInternal);
if(errorcode != RBUS_ERROR_DESTINATION_NOT_REACHABLE)
if(errorcode != RBUS_ERROR_DESTINATION_NOT_FOUND)
{
rbusEventSubscriptionInternal_free(subInternal);
}
Expand Down Expand Up @@ -5412,7 +5412,7 @@ rbusError_t rbusEvent_UnsubscribeEx(
}
}
errorcode = _rbus_event_unsubscribe(handle, subInternal);
if(errorcode != RBUS_ERROR_DESTINATION_NOT_REACHABLE)
if(errorcode != RBUS_ERROR_DESTINATION_NOT_FOUND)
{
rbusEventSubscriptionInternal_free(subInternal);
}
Expand Down
4 changes: 2 additions & 2 deletions unittests/rbusConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ int rbusConsumer(rbusGtest_t test, pid_t pid, int runtime)
{
const char *param = "Device.rbusProvider.Param2";
isElementPresent(handle, param);
rc = exec_rbus_set_test(handle, RBUS_ERROR_DESTINATION_NOT_REACHABLE, "Device.rbusProvider.Param4", "Gtest set value");
rc = exec_rbus_set_test(handle, RBUS_ERROR_DESTINATION_NOT_FOUND, "Device.rbusProvider.Param4", "Gtest set value");
}
break;
case RBUS_GTEST_SET4:
Expand Down Expand Up @@ -524,7 +524,7 @@ int rbusConsumer(rbusGtest_t test, pid_t pid, int runtime)
const char *param1 = "Device.rbusProvider.Param2";
const char *param2 = "Device.rbusProvider.Param4";
isElementPresent(handle, param1);
rc = exec_rbus_multi_test(handle, RBUS_ERROR_DESTINATION_NOT_REACHABLE, 2, param1, param2);
rc = exec_rbus_multi_test(handle, RBUS_ERROR_DESTINATION_NOT_FOUND, 2, param1, param2);
}
break;
case RBUS_GTEST_SET_MULTI4:
Expand Down

0 comments on commit b510906

Please sign in to comment.