Explorar o código

case on ECR RepositoryNotFoundException

Mohammed Nafees %!s(int64=3) %!d(string=hai) anos
pai
achega
c1306bd1e9
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      api/server/handlers/registry/list_images.go

+ 6 - 1
api/server/handlers/registry/list_images.go

@@ -1,7 +1,9 @@
 package registry
 
 import (
+	"fmt"
 	"net/http"
+	"strings"
 
 	"github.com/porter-dev/porter/api/server/handlers"
 	"github.com/porter-dev/porter/api/server/shared"
@@ -37,7 +39,10 @@ func (c *RegistryListImagesHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
 
 	imgs, err := regAPI.ListImages(repoName, c.Repo(), c.Config().DOConf)
 
-	if err != nil {
+	if err != nil && strings.Contains(err.Error(), "RepositoryNotFoundException") {
+		c.HandleAPIError(w, r, apierrors.NewErrNotFound(fmt.Errorf("no such repository: %s", repoName)))
+		return
+	} else if err != nil {
 		c.HandleAPIError(w, r, apierrors.NewErrInternal(err))
 		return
 	}