From 624a44f7f0f84a9067040809fbe2b22e092cf597 Mon Sep 17 00:00:00 2001 From: Alberto Leal Date: Tue, 4 Oct 2016 14:03:57 +0100 Subject: [PATCH] Make `errFetchManifest` public * It's quite useful to have error types exported so that libraries can avoid substring matchers Signed-off-by: Claudia Beresford --- image/docker/docker_image_src.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/image/docker/docker_image_src.go b/image/docker/docker_image_src.go index 47d47f7266..279301b79f 100644 --- a/image/docker/docker_image_src.go +++ b/image/docker/docker_image_src.go @@ -15,12 +15,13 @@ import ( "github.com/containers/image/types" ) -type errFetchManifest struct { +// ErrFetchManifest provides the error when fetching the manifest fails +type ErrFetchManifest struct { statusCode int body []byte } -func (e errFetchManifest) Error() string { +func (e ErrFetchManifest) Error() string { return fmt.Sprintf("error fetching manifest: status code: %d, body: %s", e.statusCode, string(e.body)) } @@ -114,7 +115,7 @@ func (s *dockerImageSource) ensureManifestIsLoaded() error { return err } if res.StatusCode != http.StatusOK { - return errFetchManifest{res.StatusCode, manblob} + return ErrFetchManifest{res.StatusCode, manblob} } // We might validate manblob against the Docker-Content-Digest header here to protect against transport errors. s.cachedManifest = manblob