Map error type to error code

Signed-off-by: Troels Thomsen <troels@thomsen.io>
This commit is contained in:
Troels Thomsen 2015-12-01 22:26:37 +01:00
parent beeff299f8
commit e1cf7c418b

View File

@ -169,6 +169,8 @@ func (imh *imageManifestHandler) PutImageManifest(w http.ResponseWriter, r *http
switch verificationError := verificationError.(type) { switch verificationError := verificationError.(type) {
case distribution.ErrManifestBlobUnknown: case distribution.ErrManifestBlobUnknown:
imh.Errors = append(imh.Errors, v2.ErrorCodeManifestBlobUnknown.WithDetail(verificationError.Digest)) imh.Errors = append(imh.Errors, v2.ErrorCodeManifestBlobUnknown.WithDetail(verificationError.Digest))
case distribution.ErrManifestNameInvalid:
imh.Errors = append(imh.Errors, v2.ErrorCodeNameInvalid.WithDetail(err))
case distribution.ErrManifestUnverified: case distribution.ErrManifestUnverified:
imh.Errors = append(imh.Errors, v2.ErrorCodeManifestUnverified) imh.Errors = append(imh.Errors, v2.ErrorCodeManifestUnverified)
default: default: