GET project Returns 404 instead of 500 69/111769/10
authorAditya Sharoff <aditya.sharoff@intel.com>
Wed, 26 Aug 2020 17:21:34 +0000 (10:21 -0700)
committerAditya Sharoff <aditya.sharoff@intel.com>
Fri, 4 Sep 2020 23:10:14 +0000 (16:10 -0700)
Issue-ID: MULTICLOUD-1148

Signed-off-by: Aditya Sharoff <aditya.sharoff@intel.com>
Change-Id: I482cb8ff06ebf945020c5fc185479d9911aa946a

src/orchestrator/api/projecthandler.go
src/orchestrator/api/projecthandler_test.go

index 6b51280..f130d28 100644 (file)
@@ -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
        }
 
index 6810099..ef5fdf0 100644 (file)
@@ -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{},