Return errors to caller 89/237789/3
authorprasadam <prasadam.p@samsung.com>
Fri, 3 Jul 2020 11:49:35 +0000 (17:19 +0530)
committerprasadam <prasadam.p@samsung.com>
Fri, 3 Jul 2020 12:16:23 +0000 (17:46 +0530)
Change-Id: Id915cfb0a495e5176f5575b802ac527d5dfa12b8
Signed-off-by: prasadam <prasadam.p@samsung.com>
src/stc-restriction.c

index 47bfee8..7e0e847 100755 (executable)
@@ -307,7 +307,22 @@ gboolean handle_restriction_set(StcRestriction *object,
                return TRUE;
        }
 
-       stc_plugin_monitor_add_rstn(&rule);
+       ret = stc_plugin_monitor_add_rstn(&rule);
+       if (ret == STC_ERROR_UNINITIALIZED) {
+               STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
+                                                STC_ERROR_UNINITIALIZED);
+               table_restrictions_delete(rule.app_id, rule.iftype, rule.ifname,
+                                       rule.subscriber_id, rule.roaming);
+               __stc_free_restriction_rule_members(&rule);
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return TRUE;
+       } else if (ret == STC_ERROR_NO_DATA || ret == STC_ERROR_OUT_OF_MEMORY) {
+               STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
+                                                ret);
+               __stc_free_restriction_rule_members(&rule);
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return TRUE;
+       }
        STC_DBUS_REPLY_ERROR_NONE(invocation);
        __stc_free_restriction_rule_members(&rule);
        __STC_LOG_FUNC_EXIT__;
@@ -355,7 +370,22 @@ gboolean handle_restriction_unset(StcRestriction *object,
                return TRUE;
        }
 
-       stc_plugin_monitor_remove_rstn(&rule);
+       ret = stc_plugin_monitor_remove_rstn(&rule);
+       if (ret == STC_ERROR_UNINITIALIZED) {
+               STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
+                                                STC_ERROR_UNINITIALIZED);
+               __stc_free_restriction_rule_members(&rule);
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return TRUE;
+       } else if (ret == STC_ERROR_NO_DATA) {
+               table_restrictions_update(&rule);
+               STC_RESTRICTION_DBUS_REPLY_ERROR(invocation, //LCOV_EXCL_LINE
+                                               STC_ERROR_NO_DATA);
+               __stc_free_restriction_rule_members(&rule);
+               __STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return TRUE;
+       }
+
        STC_DBUS_REPLY_ERROR_NONE(invocation);
        __stc_free_restriction_rule_members(&rule);
        __STC_LOG_FUNC_EXIT__;