Annotate bare ErrNotImplemented returns
This makes it possible to see _what_ is not implemented from the caller. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This commit is contained in:
		| @@ -178,7 +178,7 @@ func (s windowsLcowDiff) Apply(ctx context.Context, desc ocispec.Descriptor, mou | |||||||
| // Compare creates a diff between the given mounts and uploads the result | // Compare creates a diff between the given mounts and uploads the result | ||||||
| // to the content store. | // to the content store. | ||||||
| func (s windowsLcowDiff) Compare(ctx context.Context, lower, upper []mount.Mount, opts ...diff.Opt) (d ocispec.Descriptor, err error) { | func (s windowsLcowDiff) Compare(ctx context.Context, lower, upper []mount.Mount, opts ...diff.Opt) (d ocispec.Descriptor, err error) { | ||||||
| 	return emptyDesc, errdefs.ErrNotImplemented | 	return emptyDesc, errors.Wrap(errdefs.ErrNotImplemented, "windowsLcowDiff does not implement Compare method") | ||||||
| } | } | ||||||
|  |  | ||||||
| type readCounter struct { | type readCounter struct { | ||||||
|   | |||||||
| @@ -158,7 +158,7 @@ func (s windowsDiff) Apply(ctx context.Context, desc ocispec.Descriptor, mounts | |||||||
| // Compare creates a diff between the given mounts and uploads the result | // Compare creates a diff between the given mounts and uploads the result | ||||||
| // to the content store. | // to the content store. | ||||||
| func (s windowsDiff) Compare(ctx context.Context, lower, upper []mount.Mount, opts ...diff.Opt) (d ocispec.Descriptor, err error) { | func (s windowsDiff) Compare(ctx context.Context, lower, upper []mount.Mount, opts ...diff.Opt) (d ocispec.Descriptor, err error) { | ||||||
| 	return emptyDesc, errdefs.ErrNotImplemented | 	return emptyDesc, errors.Wrap(errdefs.ErrNotImplemented, "windowsDiff does not implement Compare method") | ||||||
| } | } | ||||||
|  |  | ||||||
| type readCounter struct { | type readCounter struct { | ||||||
| @@ -181,7 +181,7 @@ func mountsToLayerAndParents(mounts []mount.Mount) (string, []string, error) { | |||||||
| 		// This is a special case error. When this is received the diff service | 		// This is a special case error. When this is received the diff service | ||||||
| 		// will attempt the next differ in the chain which for Windows is the | 		// will attempt the next differ in the chain which for Windows is the | ||||||
| 		// lcow differ that we want. | 		// lcow differ that we want. | ||||||
| 		return "", nil, errdefs.ErrNotImplemented | 		return "", nil, errors.Wrapf(errdefs.ErrNotImplemented, "windowsDiff does not support layer type %s", mnt.Type) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	parentLayerPaths, err := mnt.GetParentPaths() | 	parentLayerPaths, err := mnt.GetParentPaths() | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/errdefs" | 	"github.com/containerd/containerd/errdefs" | ||||||
| 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | ||||||
|  | 	"github.com/pkg/errors" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // mediatype definitions for image components handled in containerd. | // mediatype definitions for image components handled in containerd. | ||||||
| @@ -81,7 +82,7 @@ func DiffCompression(ctx context.Context, mediaType string) (string, error) { | |||||||
| 		} | 		} | ||||||
| 		return "", nil | 		return "", nil | ||||||
| 	default: | 	default: | ||||||
| 		return "", errdefs.ErrNotImplemented | 		return "", errors.Wrapf(errdefs.ErrNotImplemented, "unrecognised mediatype %s", mediaType) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Paul "TBBle" Hampson
					Paul "TBBle" Hampson