...

Source file src/github.com/docker/distribution/registry/api/v2/errors.go

Documentation: github.com/docker/distribution/registry/api/v2

     1  package v2
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/docker/distribution/registry/api/errcode"
     7  )
     8  
     9  const errGroup = "registry.api.v2"
    10  
    11  var (
    12  	// ErrorCodeDigestInvalid is returned when uploading a blob if the
    13  	// provided digest does not match the blob contents.
    14  	ErrorCodeDigestInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
    15  		Value:   "DIGEST_INVALID",
    16  		Message: "provided digest did not match uploaded content",
    17  		Description: `When a blob is uploaded, the registry will check that
    18  		the content matches the digest provided by the client. The error may
    19  		include a detail structure with the key "digest", including the
    20  		invalid digest string. This error may also be returned when a manifest
    21  		includes an invalid layer digest.`,
    22  		HTTPStatusCode: http.StatusBadRequest,
    23  	})
    24  
    25  	// ErrorCodeSizeInvalid is returned when uploading a blob if the provided
    26  	ErrorCodeSizeInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
    27  		Value:   "SIZE_INVALID",
    28  		Message: "provided length did not match content length",
    29  		Description: `When a layer is uploaded, the provided size will be
    30  		checked against the uploaded content. If they do not match, this error
    31  		will be returned.`,
    32  		HTTPStatusCode: http.StatusBadRequest,
    33  	})
    34  
    35  	// ErrorCodeNameInvalid is returned when the name in the manifest does not
    36  	// match the provided name.
    37  	ErrorCodeNameInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
    38  		Value:   "NAME_INVALID",
    39  		Message: "invalid repository name",
    40  		Description: `Invalid repository name encountered either during
    41  		manifest validation or any API operation.`,
    42  		HTTPStatusCode: http.StatusBadRequest,
    43  	})
    44  
    45  	// ErrorCodeTagInvalid is returned when the tag in the manifest does not
    46  	// match the provided tag.
    47  	ErrorCodeTagInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
    48  		Value:   "TAG_INVALID",
    49  		Message: "manifest tag did not match URI",
    50  		Description: `During a manifest upload, if the tag in the manifest
    51  		does not match the uri tag, this error will be returned.`,
    52  		HTTPStatusCode: http.StatusBadRequest,
    53  	})
    54  
    55  	// ErrorCodeNameUnknown when the repository name is not known.
    56  	ErrorCodeNameUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
    57  		Value:   "NAME_UNKNOWN",
    58  		Message: "repository name not known to registry",
    59  		Description: `This is returned if the name used during an operation is
    60  		unknown to the registry.`,
    61  		HTTPStatusCode: http.StatusNotFound,
    62  	})
    63  
    64  	// ErrorCodeManifestUnknown returned when image manifest is unknown.
    65  	ErrorCodeManifestUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
    66  		Value:   "MANIFEST_UNKNOWN",
    67  		Message: "manifest unknown",
    68  		Description: `This error is returned when the manifest, identified by
    69  		name and tag is unknown to the repository.`,
    70  		HTTPStatusCode: http.StatusNotFound,
    71  	})
    72  
    73  	// ErrorCodeManifestInvalid returned when an image manifest is invalid,
    74  	// typically during a PUT operation. This error encompasses all errors
    75  	// encountered during manifest validation that aren't signature errors.
    76  	ErrorCodeManifestInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
    77  		Value:   "MANIFEST_INVALID",
    78  		Message: "manifest invalid",
    79  		Description: `During upload, manifests undergo several checks ensuring
    80  		validity. If those checks fail, this error may be returned, unless a
    81  		more specific error is included. The detail will contain information
    82  		the failed validation.`,
    83  		HTTPStatusCode: http.StatusBadRequest,
    84  	})
    85  
    86  	// ErrorCodeManifestUnverified is returned when the manifest fails
    87  	// signature verification.
    88  	ErrorCodeManifestUnverified = errcode.Register(errGroup, errcode.ErrorDescriptor{
    89  		Value:   "MANIFEST_UNVERIFIED",
    90  		Message: "manifest failed signature verification",
    91  		Description: `During manifest upload, if the manifest fails signature
    92  		verification, this error will be returned.`,
    93  		HTTPStatusCode: http.StatusBadRequest,
    94  	})
    95  
    96  	// ErrorCodeManifestBlobUnknown is returned when a manifest blob is
    97  	// unknown to the registry.
    98  	ErrorCodeManifestBlobUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
    99  		Value:   "MANIFEST_BLOB_UNKNOWN",
   100  		Message: "blob unknown to registry",
   101  		Description: `This error may be returned when a manifest blob is 
   102  		unknown to the registry.`,
   103  		HTTPStatusCode: http.StatusBadRequest,
   104  	})
   105  
   106  	// ErrorCodeBlobUnknown is returned when a blob is unknown to the
   107  	// registry. This can happen when the manifest references a nonexistent
   108  	// layer or the result is not found by a blob fetch.
   109  	ErrorCodeBlobUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
   110  		Value:   "BLOB_UNKNOWN",
   111  		Message: "blob unknown to registry",
   112  		Description: `This error may be returned when a blob is unknown to the
   113  		registry in a specified repository. This can be returned with a
   114  		standard get or if a manifest references an unknown layer during
   115  		upload.`,
   116  		HTTPStatusCode: http.StatusNotFound,
   117  	})
   118  
   119  	// ErrorCodeBlobUploadUnknown is returned when an upload is unknown.
   120  	ErrorCodeBlobUploadUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
   121  		Value:   "BLOB_UPLOAD_UNKNOWN",
   122  		Message: "blob upload unknown to registry",
   123  		Description: `If a blob upload has been cancelled or was never
   124  		started, this error code may be returned.`,
   125  		HTTPStatusCode: http.StatusNotFound,
   126  	})
   127  
   128  	// ErrorCodeBlobUploadInvalid is returned when an upload is invalid.
   129  	ErrorCodeBlobUploadInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
   130  		Value:   "BLOB_UPLOAD_INVALID",
   131  		Message: "blob upload invalid",
   132  		Description: `The blob upload encountered an error and can no
   133  		longer proceed.`,
   134  		HTTPStatusCode: http.StatusNotFound,
   135  	})
   136  
   137  	ErrorCodePaginationNumberInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
   138  		Value:   "PAGINATION_NUMBER_INVALID",
   139  		Message: "invalid number of results requested",
   140  		Description: `Returned when the "n" parameter (number of results
   141  		to return) is not an integer, "n" is negative or "n" is bigger than
   142  		the maximum allowed.`,
   143  		HTTPStatusCode: http.StatusBadRequest,
   144  	})
   145  )
   146  

View as plain text