From 5acf66575ff8657390143d12cda137f5a2d7c2fa Mon Sep 17 00:00:00 2001 From: Le Yao Date: Tue, 1 Dec 2020 08:44:15 +0000 Subject: [PATCH] Handle some un-covered errors Response error code and message to client Signed-off-by: Le Yao Change-Id: I326ccb7411ba938f37da53e57b206c4800bca2e2 --- platform/cnf/src/rest_v1/svc_rest.lua | 4 ++++ 1 file changed, 4 insertions(+) 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") -- 2.16.6