From 3bc5164b3ea166dd84a4c5f63ed95745100a324b Mon Sep 17 00:00:00 2001 From: Aditya Sharoff Date: Wed, 9 Sep 2020 16:22:32 -0700 Subject: Delete issues error code 404 when project name is invalid Issue-ID: MULTICLOUD-1147 Signed-off-by: Aditya Sharoff Change-Id: I659dfcb00b3f15bcf787ac3947f8755737b1fc39 --- src/orchestrator/api/projecthandler.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/orchestrator/api/projecthandler.go') diff --git a/src/orchestrator/api/projecthandler.go b/src/orchestrator/api/projecthandler.go index 07cd79ce..e88114a1 100644 --- a/src/orchestrator/api/projecthandler.go +++ b/src/orchestrator/api/projecthandler.go @@ -167,7 +167,13 @@ func (h projectHandler) deleteHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) name := vars["project-name"] - err := h.client.DeleteProject(name) + _, err := h.client.GetProject(name) + if err != nil { + http.Error(w, err.Error(), http.StatusNotFound) + return + } + + err = h.client.DeleteProject(name) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return -- cgit 1.2.3-korg