diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-13 21:53:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-13 21:53:05 +0200 |
commit | d1ba9ce555099ad4cf2fd49c4598edaae0bfe0e4 (patch) | |
tree | 7db855dfb9250cc1cebb9a0ab7ab6e54933b184c /pkg/api/handlers/compat/images.go | |
parent | 98708b1268a6083dcb068d6e22d409bd9a47ec62 (diff) | |
parent | ef5c8846737f4c9697f34bd920718d2b1292ad49 (diff) | |
download | podman-d1ba9ce555099ad4cf2fd49c4598edaae0bfe0e4.tar.gz podman-d1ba9ce555099ad4cf2fd49c4598edaae0bfe0e4.tar.bz2 podman-d1ba9ce555099ad4cf2fd49c4598edaae0bfe0e4.zip |
Merge pull request #8009 from baude/nosuchimage
alter compat no such image message
Diffstat (limited to 'pkg/api/handlers/compat/images.go')
-rw-r--r-- | pkg/api/handlers/compat/images.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go index f49ce59da..3431823bd 100644 --- a/pkg/api/handlers/compat/images.go +++ b/pkg/api/handlers/compat/images.go @@ -327,7 +327,10 @@ func GetImage(w http.ResponseWriter, r *http.Request) { name := utils.GetName(r) newImage, err := utils.GetImage(r, name) if err != nil { - utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name)) + // Here we need to fiddle with the error message because docker-py is looking for "No + // such image" to determine on how to raise the correct exception. + errMsg := strings.ReplaceAll(err.Error(), "no such image", "No such image") + utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Errorf("failed to find image %s: %s", name, errMsg)) return } inspect, err := handlers.ImageDataToImageInspect(r.Context(), newImage) |