Skip to content

Commit

Permalink
Define an error to allow an external reference
Browse files Browse the repository at this point in the history
Signed-off-by: zhangguanzhang <[email protected]>
  • Loading branch information
zhangguanzhang committed Aug 19, 2020
1 parent 8c16c7d commit 0836b39
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 0836b39

Please sign in to comment.