From: Aditya Sharoff Date: Wed, 26 Aug 2020 17:21:34 +0000 (-0700) Subject: GET project Returns 404 instead of 500 X-Git-Tag: 0.7.0~44^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=a512a6d07e844f8e1d24608a0f1e4265bb85d341;p=multicloud%2Fk8s.git GET project Returns 404 instead of 500 Issue-ID: MULTICLOUD-1148 Signed-off-by: Aditya Sharoff Change-Id: I482cb8ff06ebf945020c5fc185479d9911aa946a --- diff --git a/src/orchestrator/api/projecthandler.go b/src/orchestrator/api/projecthandler.go index 6b512804..f130d283 100644 --- a/src/orchestrator/api/projecthandler.go +++ b/src/orchestrator/api/projecthandler.go @@ -126,7 +126,7 @@ func (h projectHandler) getHandler(w http.ResponseWriter, r *http.Request) { projects, err := h.client.GetAllProjects() if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) + http.Error(w, err.Error(), http.StatusNotFound) return } @@ -147,7 +147,7 @@ func (h projectHandler) getHandler(w http.ResponseWriter, r *http.Request) { ret, err := h.client.GetProject(name) if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) + http.Error(w, err.Error(), http.StatusNotFound) return } diff --git a/src/orchestrator/api/projecthandler_test.go b/src/orchestrator/api/projecthandler_test.go index 6810099f..ef5fdf07 100644 --- a/src/orchestrator/api/projecthandler_test.go +++ b/src/orchestrator/api/projecthandler_test.go @@ -273,7 +273,7 @@ func TestProjectGetHandler(t *testing.T) { }, { label: "Get Non-Exiting Project", - expectedCode: http.StatusInternalServerError, + expectedCode: http.StatusNotFound, name: "nonexistingproject", projectClient: &mockProjectManager{ Items: []moduleLib.Project{},