Skip to content

Commit

Permalink
Merge pull request #2595 from mtrmac/error-text
Browse files Browse the repository at this point in the history
Improve an error message
  • Loading branch information
mtrmac authored Nov 21, 2024
2 parents b706d93 + 175ffae commit fdfb166
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion storage/storage_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ func (s *storageReference) resolveImage(sys *types.SystemContext) (*storage.Imag
}
if s.id == "" {
logrus.Debugf("reference %q does not resolve to an image ID", s.StringWithinTransport())
return nil, fmt.Errorf("reference %q does not resolve to an image ID: %w", s.StringWithinTransport(), ErrNoSuchImage)
// %.0w makes the error visible to error.Unwrap() without including any text.
// ErrNoSuchImage ultimately is “identifier is not an image”, which is not helpful for identifying the root cause.
return nil, fmt.Errorf("reference %q does not resolve to an image ID%.0w", s.StringWithinTransport(), ErrNoSuchImage)
}
if loadedImage == nil {
img, err := s.transport.store.Image(s.id)
Expand Down

0 comments on commit fdfb166

Please sign in to comment.