Skip to content

Commit

Permalink
Merge pull request #8009 from baude/nosuchimage
Browse files Browse the repository at this point in the history
alter compat no such image message
  • Loading branch information
openshift-merge-robot authored Oct 13, 2020
2 parents 98708b1 + ef5c884 commit d1ba9ce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/api/handlers/compat/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d1ba9ce

Please sign in to comment.