Handle some un-covered errors 55/3955/1
authorLe Yao <le.yao@intel.com>
Tue, 1 Dec 2020 08:44:15 +0000 (08:44 +0000)
committerLe Yao <le.yao@intel.com>
Wed, 2 Dec 2020 07:08:26 +0000 (07:08 +0000)
Response error code and message to client

Signed-off-by: Le Yao <le.yao@intel.com>
Change-Id: I326ccb7411ba938f37da53e57b206c4800bca2e2

platform/cnf/src/rest_v1/svc_rest.lua

index 06e9e6e..219250c 100644 (file)
@@ -35,6 +35,7 @@ end
 function create_service()
     local obj = utils.get_request_body_object()
     if obj == nil then
+        utils.response_error(400, "No Service Data")
         return
     end
     if is_invalid(obj.port, obj.dport) then
@@ -75,6 +76,9 @@ end
 -- Delete
 function delete_service()
     local uri_list = utils.get_URI_list(7)
+    if uri_list == nil then
+        return
+    end
     local name = uri_list[#uri_list]
     local info_file = io.open("/etc/sdewan_svc.info", "w")
     local up_file = io.open("/etc/sdewan_svc.up", "r")