From: Le Yao Date: Tue, 1 Dec 2020 08:44:15 +0000 (+0000) Subject: Handle some un-covered errors X-Git-Tag: 21-12-01~24^2 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=5acf66575ff8657390143d12cda137f5a2d7c2fa;p=icn%2Fsdwan.git Handle some un-covered errors Response error code and message to client Signed-off-by: Le Yao Change-Id: I326ccb7411ba938f37da53e57b206c4800bca2e2 --- diff --git a/platform/cnf/src/rest_v1/svc_rest.lua b/platform/cnf/src/rest_v1/svc_rest.lua index 06e9e6e..219250c 100644 --- a/platform/cnf/src/rest_v1/svc_rest.lua +++ b/platform/cnf/src/rest_v1/svc_rest.lua @@ -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")