Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define an error to allow an external reference #1029

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion oci/layout/oci_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ var (
// ErrMoreThanOneImage is an error returned when the manifest includes
// more than one image and the user should choose which one to use.
ErrMoreThanOneImage = errors.New("more than one image in oci, choose an image")

// ErrNotFoundDescriptor is an error when the reference cannot found in the manifests
ErrNotFoundDescriptor = errors.New("no descriptor found for the reference")
)

type ociTransport struct{}
Expand Down Expand Up @@ -209,7 +212,7 @@ func (ref ociReference) getManifestDescriptor() (imgspecv1.Descriptor, error) {
}
}
if d == nil {
return imgspecv1.Descriptor{}, fmt.Errorf("no descriptor found for reference %q", ref.image)
return imgspecv1.Descriptor{}, errors.Wrap(ErrNotFoundDescriptor, ref.image)
}
return *d, nil
}
Expand Down