Merge pull request #119 from albertoleal/export-error-type

Make `errFetchManifest` public
This commit is contained in:
Antonio Murdaca 2016-10-04 17:46:17 +02:00 committed by GitHub
commit 6efd016e38
1 changed files with 4 additions and 3 deletions

View File

@ -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