registry/api: move all errors to "errcode" package
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
a2e65220ae
commit
292e30bc61
13 changed files with 352 additions and 280 deletions
|
@ -75,6 +75,157 @@ var (
|
|||
})
|
||||
)
|
||||
|
||||
const errGroup = "registry.api.v2"
|
||||
|
||||
var (
|
||||
// ErrorCodeDigestInvalid is returned when uploading a blob if the
|
||||
// provided digest does not match the blob contents.
|
||||
ErrorCodeDigestInvalid = Register(errGroup, ErrorDescriptor{
|
||||
Value: "DIGEST_INVALID",
|
||||
Message: "provided digest did not match uploaded content",
|
||||
Description: `When a blob is uploaded, the registry will check that
|
||||
the content matches the digest provided by the client. The error may
|
||||
include a detail structure with the key "digest", including the
|
||||
invalid digest string. This error may also be returned when a manifest
|
||||
includes an invalid layer digest.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeSizeInvalid is returned when uploading a blob if the provided
|
||||
ErrorCodeSizeInvalid = Register(errGroup, ErrorDescriptor{
|
||||
Value: "SIZE_INVALID",
|
||||
Message: "provided length did not match content length",
|
||||
Description: `When a layer is uploaded, the provided size will be
|
||||
checked against the uploaded content. If they do not match, this error
|
||||
will be returned.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeRangeInvalid is returned when uploading a blob if the provided
|
||||
// content range is invalid.
|
||||
ErrorCodeRangeInvalid = Register(errGroup, ErrorDescriptor{
|
||||
Value: "RANGE_INVALID",
|
||||
Message: "invalid content range",
|
||||
Description: `When a layer is uploaded, the provided range is checked
|
||||
against the uploaded chunk. This error is returned if the range is
|
||||
out of order.`,
|
||||
HTTPStatusCode: http.StatusRequestedRangeNotSatisfiable,
|
||||
})
|
||||
|
||||
// ErrorCodeNameInvalid is returned when the name in the manifest does not
|
||||
// match the provided name.
|
||||
ErrorCodeNameInvalid = Register(errGroup, ErrorDescriptor{
|
||||
Value: "NAME_INVALID",
|
||||
Message: "invalid repository name",
|
||||
Description: `Invalid repository name encountered either during
|
||||
manifest validation or any API operation.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeTagInvalid is returned when the tag in the manifest does not
|
||||
// match the provided tag.
|
||||
ErrorCodeTagInvalid = Register(errGroup, ErrorDescriptor{
|
||||
Value: "TAG_INVALID",
|
||||
Message: "manifest tag did not match URI",
|
||||
Description: `During a manifest upload, if the tag in the manifest
|
||||
does not match the uri tag, this error will be returned.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeNameUnknown when the repository name is not known.
|
||||
ErrorCodeNameUnknown = Register(errGroup, ErrorDescriptor{
|
||||
Value: "NAME_UNKNOWN",
|
||||
Message: "repository name not known to registry",
|
||||
Description: `This is returned if the name used during an operation is
|
||||
unknown to the registry.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeManifestUnknown returned when image manifest is unknown.
|
||||
ErrorCodeManifestUnknown = Register(errGroup, ErrorDescriptor{
|
||||
Value: "MANIFEST_UNKNOWN",
|
||||
Message: "manifest unknown",
|
||||
Description: `This error is returned when the manifest, identified by
|
||||
name and tag is unknown to the repository.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeManifestInvalid returned when an image manifest is invalid,
|
||||
// typically during a PUT operation. This error encompasses all errors
|
||||
// encountered during manifest validation that aren't signature errors.
|
||||
ErrorCodeManifestInvalid = Register(errGroup, ErrorDescriptor{
|
||||
Value: "MANIFEST_INVALID",
|
||||
Message: "manifest invalid",
|
||||
Description: `During upload, manifests undergo several checks ensuring
|
||||
validity. If those checks fail, this error may be returned, unless a
|
||||
more specific error is included. The detail will contain information
|
||||
the failed validation.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeManifestUnverified is returned when the manifest fails
|
||||
// signature verification.
|
||||
ErrorCodeManifestUnverified = Register(errGroup, ErrorDescriptor{
|
||||
Value: "MANIFEST_UNVERIFIED",
|
||||
Message: "manifest failed signature verification",
|
||||
Description: `During manifest upload, if the manifest fails signature
|
||||
verification, this error will be returned.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeManifestBlobUnknown is returned when a manifest blob is
|
||||
// unknown to the registry.
|
||||
ErrorCodeManifestBlobUnknown = Register(errGroup, ErrorDescriptor{
|
||||
Value: "MANIFEST_BLOB_UNKNOWN",
|
||||
Message: "blob unknown to registry",
|
||||
Description: `This error may be returned when a manifest blob is
|
||||
unknown to the registry.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeBlobUnknown is returned when a blob is unknown to the
|
||||
// registry. This can happen when the manifest references a nonexistent
|
||||
// layer or the result is not found by a blob fetch.
|
||||
ErrorCodeBlobUnknown = Register(errGroup, ErrorDescriptor{
|
||||
Value: "BLOB_UNKNOWN",
|
||||
Message: "blob unknown to registry",
|
||||
Description: `This error may be returned when a blob is unknown to the
|
||||
registry in a specified repository. This can be returned with a
|
||||
standard get or if a manifest references an unknown layer during
|
||||
upload.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeBlobUploadUnknown is returned when an upload is unknown.
|
||||
ErrorCodeBlobUploadUnknown = Register(errGroup, ErrorDescriptor{
|
||||
Value: "BLOB_UPLOAD_UNKNOWN",
|
||||
Message: "blob upload unknown to registry",
|
||||
Description: `If a blob upload has been cancelled or was never
|
||||
started, this error code may be returned.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeBlobUploadInvalid is returned when an upload is invalid.
|
||||
ErrorCodeBlobUploadInvalid = Register(errGroup, ErrorDescriptor{
|
||||
Value: "BLOB_UPLOAD_INVALID",
|
||||
Message: "blob upload invalid",
|
||||
Description: `The blob upload encountered an error and can no
|
||||
longer proceed.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodePaginationNumberInvalid is returned when the `n` parameter is
|
||||
// not an integer, or `n` is negative.
|
||||
ErrorCodePaginationNumberInvalid = Register(errGroup, ErrorDescriptor{
|
||||
Value: "PAGINATION_NUMBER_INVALID",
|
||||
Message: "invalid number of results requested",
|
||||
Description: `Returned when the "n" parameter (number of results
|
||||
to return) is not an integer, "n" is negative or "n" is bigger than
|
||||
the maximum allowed.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
)
|
||||
|
||||
var (
|
||||
nextCode = 1000
|
||||
registerLock sync.Mutex
|
||||
|
|
|
@ -143,7 +143,7 @@ var (
|
|||
Format: errorsBody,
|
||||
},
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodePaginationNumberInvalid,
|
||||
errcode.ErrorCodePaginationNumberInvalid,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ var (
|
|||
Format: errorsBody,
|
||||
},
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameUnknown,
|
||||
errcode.ErrorCodeNameUnknown,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -550,8 +550,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "The name or reference was invalid.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeTagInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeTagInvalid,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -609,11 +609,11 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Format: errorsBody,
|
||||
},
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeTagInvalid,
|
||||
ErrorCodeManifestInvalid,
|
||||
ErrorCodeManifestUnverified,
|
||||
ErrorCodeBlobUnknown,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeTagInvalid,
|
||||
errcode.ErrorCodeManifestInvalid,
|
||||
errcode.ErrorCodeManifestUnverified,
|
||||
errcode.ErrorCodeBlobUnknown,
|
||||
},
|
||||
},
|
||||
unauthorizedResponseDescriptor,
|
||||
|
@ -625,7 +625,7 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "One or more layers may be missing during a manifest upload. If so, the missing layers will be enumerated in the error response.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeBlobUnknown,
|
||||
errcode.ErrorCodeBlobUnknown,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -678,8 +678,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "The specified `name` or `reference` were invalid and the delete was unable to proceed.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeTagInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeTagInvalid,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -695,8 +695,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "The specified `name` or `reference` are unknown to the registry and the delete was unable to proceed. Clients can assume the manifest or tag was already deleted if this response is returned.",
|
||||
StatusCode: http.StatusNotFound,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameUnknown,
|
||||
ErrorCodeManifestUnknown,
|
||||
errcode.ErrorCodeNameUnknown,
|
||||
errcode.ErrorCodeManifestUnknown,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -775,8 +775,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "There was a problem with the request that needs to be addressed by the client, such as an invalid `name` or `tag`.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -791,8 +791,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Format: errorsBody,
|
||||
},
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameUnknown,
|
||||
ErrorCodeBlobUnknown,
|
||||
errcode.ErrorCodeNameUnknown,
|
||||
errcode.ErrorCodeBlobUnknown,
|
||||
},
|
||||
},
|
||||
unauthorizedResponseDescriptor,
|
||||
|
@ -847,8 +847,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "There was a problem with the request that needs to be addressed by the client, such as an invalid `name` or `tag`.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -858,8 +858,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
{
|
||||
StatusCode: http.StatusNotFound,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameUnknown,
|
||||
ErrorCodeBlobUnknown,
|
||||
errcode.ErrorCodeNameUnknown,
|
||||
errcode.ErrorCodeBlobUnknown,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -910,8 +910,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Name: "Invalid Name or Digest",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeDigestInvalid,
|
||||
ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -922,8 +922,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Format: errorsBody,
|
||||
},
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameUnknown,
|
||||
ErrorCodeBlobUnknown,
|
||||
errcode.ErrorCodeNameUnknown,
|
||||
errcode.ErrorCodeBlobUnknown,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1010,8 +1010,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Name: "Invalid Name or Digest",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeDigestInvalid,
|
||||
ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1065,8 +1065,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Name: "Invalid Name or Digest",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeDigestInvalid,
|
||||
ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
},
|
||||
},
|
||||
unauthorizedResponseDescriptor,
|
||||
|
@ -1122,8 +1122,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Name: "Invalid Name or Digest",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeDigestInvalid,
|
||||
ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1187,9 +1187,9 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "There was an error processing the upload and it must be restarted.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeDigestInvalid,
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeBlobUploadInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeBlobUploadInvalid,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -1200,7 +1200,7 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "The upload is unknown to the registry. The upload must be restarted.",
|
||||
StatusCode: http.StatusNotFound,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeBlobUploadUnknown,
|
||||
errcode.ErrorCodeBlobUploadUnknown,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -1262,9 +1262,9 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "There was an error processing the upload and it must be restarted.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeDigestInvalid,
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeBlobUploadInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeBlobUploadInvalid,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -1275,7 +1275,7 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "The upload is unknown to the registry. The upload must be restarted.",
|
||||
StatusCode: http.StatusNotFound,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeBlobUploadUnknown,
|
||||
errcode.ErrorCodeBlobUploadUnknown,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -1344,9 +1344,9 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "There was an error processing the upload and it must be restarted.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeDigestInvalid,
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeBlobUploadInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeBlobUploadInvalid,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -1357,7 +1357,7 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "The upload is unknown to the registry. The upload must be restarted.",
|
||||
StatusCode: http.StatusNotFound,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeBlobUploadUnknown,
|
||||
errcode.ErrorCodeBlobUploadUnknown,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -1438,9 +1438,9 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "There was an error processing the upload and it must be restarted.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeDigestInvalid,
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeBlobUploadInvalid,
|
||||
errcode.ErrorCodeDigestInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeBlobUploadInvalid,
|
||||
errcode.ErrorCodeUnsupported,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
|
@ -1452,7 +1452,7 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "The upload is unknown to the registry. The upload must be restarted.",
|
||||
StatusCode: http.StatusNotFound,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeBlobUploadUnknown,
|
||||
errcode.ErrorCodeBlobUploadUnknown,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -1497,8 +1497,8 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "An error was encountered processing the delete. The client may ignore this error.",
|
||||
StatusCode: http.StatusBadRequest,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeNameInvalid,
|
||||
ErrorCodeBlobUploadInvalid,
|
||||
errcode.ErrorCodeNameInvalid,
|
||||
errcode.ErrorCodeBlobUploadInvalid,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
@ -1509,7 +1509,7 @@ var routeDescriptors = []RouteDescriptor{
|
|||
Description: "The upload is unknown to the registry. The client may ignore this error and assume the upload has been deleted.",
|
||||
StatusCode: http.StatusNotFound,
|
||||
ErrorCodes: []errcode.ErrorCode{
|
||||
ErrorCodeBlobUploadUnknown,
|
||||
errcode.ErrorCodeBlobUploadUnknown,
|
||||
},
|
||||
Body: BodyDescriptor{
|
||||
ContentType: "application/json",
|
||||
|
|
|
@ -1,158 +0,0 @@
|
|||
package v2
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/distribution/distribution/v3/registry/api/errcode"
|
||||
)
|
||||
|
||||
const errGroup = "registry.api.v2"
|
||||
|
||||
var (
|
||||
// ErrorCodeDigestInvalid is returned when uploading a blob if the
|
||||
// provided digest does not match the blob contents.
|
||||
ErrorCodeDigestInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "DIGEST_INVALID",
|
||||
Message: "provided digest did not match uploaded content",
|
||||
Description: `When a blob is uploaded, the registry will check that
|
||||
the content matches the digest provided by the client. The error may
|
||||
include a detail structure with the key "digest", including the
|
||||
invalid digest string. This error may also be returned when a manifest
|
||||
includes an invalid layer digest.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeSizeInvalid is returned when uploading a blob if the provided
|
||||
ErrorCodeSizeInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "SIZE_INVALID",
|
||||
Message: "provided length did not match content length",
|
||||
Description: `When a layer is uploaded, the provided size will be
|
||||
checked against the uploaded content. If they do not match, this error
|
||||
will be returned.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeRangeInvalid is returned when uploading a blob if the provided
|
||||
// content range is invalid.
|
||||
ErrorCodeRangeInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "RANGE_INVALID",
|
||||
Message: "invalid content range",
|
||||
Description: `When a layer is uploaded, the provided range is checked
|
||||
against the uploaded chunk. This error is returned if the range is
|
||||
out of order.`,
|
||||
HTTPStatusCode: http.StatusRequestedRangeNotSatisfiable,
|
||||
})
|
||||
|
||||
// ErrorCodeNameInvalid is returned when the name in the manifest does not
|
||||
// match the provided name.
|
||||
ErrorCodeNameInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NAME_INVALID",
|
||||
Message: "invalid repository name",
|
||||
Description: `Invalid repository name encountered either during
|
||||
manifest validation or any API operation.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeTagInvalid is returned when the tag in the manifest does not
|
||||
// match the provided tag.
|
||||
ErrorCodeTagInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "TAG_INVALID",
|
||||
Message: "manifest tag did not match URI",
|
||||
Description: `During a manifest upload, if the tag in the manifest
|
||||
does not match the uri tag, this error will be returned.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeNameUnknown when the repository name is not known.
|
||||
ErrorCodeNameUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "NAME_UNKNOWN",
|
||||
Message: "repository name not known to registry",
|
||||
Description: `This is returned if the name used during an operation is
|
||||
unknown to the registry.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeManifestUnknown returned when image manifest is unknown.
|
||||
ErrorCodeManifestUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "MANIFEST_UNKNOWN",
|
||||
Message: "manifest unknown",
|
||||
Description: `This error is returned when the manifest, identified by
|
||||
name and tag is unknown to the repository.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeManifestInvalid returned when an image manifest is invalid,
|
||||
// typically during a PUT operation. This error encompasses all errors
|
||||
// encountered during manifest validation that aren't signature errors.
|
||||
ErrorCodeManifestInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "MANIFEST_INVALID",
|
||||
Message: "manifest invalid",
|
||||
Description: `During upload, manifests undergo several checks ensuring
|
||||
validity. If those checks fail, this error may be returned, unless a
|
||||
more specific error is included. The detail will contain information
|
||||
the failed validation.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeManifestUnverified is returned when the manifest fails
|
||||
// signature verification.
|
||||
ErrorCodeManifestUnverified = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "MANIFEST_UNVERIFIED",
|
||||
Message: "manifest failed signature verification",
|
||||
Description: `During manifest upload, if the manifest fails signature
|
||||
verification, this error will be returned.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeManifestBlobUnknown is returned when a manifest blob is
|
||||
// unknown to the registry.
|
||||
ErrorCodeManifestBlobUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "MANIFEST_BLOB_UNKNOWN",
|
||||
Message: "blob unknown to registry",
|
||||
Description: `This error may be returned when a manifest blob is
|
||||
unknown to the registry.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
|
||||
// ErrorCodeBlobUnknown is returned when a blob is unknown to the
|
||||
// registry. This can happen when the manifest references a nonexistent
|
||||
// layer or the result is not found by a blob fetch.
|
||||
ErrorCodeBlobUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "BLOB_UNKNOWN",
|
||||
Message: "blob unknown to registry",
|
||||
Description: `This error may be returned when a blob is unknown to the
|
||||
registry in a specified repository. This can be returned with a
|
||||
standard get or if a manifest references an unknown layer during
|
||||
upload.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeBlobUploadUnknown is returned when an upload is unknown.
|
||||
ErrorCodeBlobUploadUnknown = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "BLOB_UPLOAD_UNKNOWN",
|
||||
Message: "blob upload unknown to registry",
|
||||
Description: `If a blob upload has been cancelled or was never
|
||||
started, this error code may be returned.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodeBlobUploadInvalid is returned when an upload is invalid.
|
||||
ErrorCodeBlobUploadInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "BLOB_UPLOAD_INVALID",
|
||||
Message: "blob upload invalid",
|
||||
Description: `The blob upload encountered an error and can no
|
||||
longer proceed.`,
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
})
|
||||
|
||||
// ErrorCodePaginationNumberInvalid is returned when the `n` parameter is
|
||||
// not an integer, or `n` is negative.
|
||||
ErrorCodePaginationNumberInvalid = errcode.Register(errGroup, errcode.ErrorDescriptor{
|
||||
Value: "PAGINATION_NUMBER_INVALID",
|
||||
Message: "invalid number of results requested",
|
||||
Description: `Returned when the "n" parameter (number of results
|
||||
to return) is not an integer, "n" is negative or "n" is bigger than
|
||||
the maximum allowed.`,
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
})
|
||||
)
|
86
registry/api/v2/errors_deprecated.go
Normal file
86
registry/api/v2/errors_deprecated.go
Normal file
|
@ -0,0 +1,86 @@
|
|||
package v2
|
||||
|
||||
import "github.com/distribution/distribution/v3/registry/api/errcode"
|
||||
|
||||
var (
|
||||
// ErrorCodeDigestInvalid is returned when uploading a blob if the
|
||||
// provided digest does not match the blob contents.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeDigestInvalid].
|
||||
ErrorCodeDigestInvalid = errcode.ErrorCodeDigestInvalid
|
||||
|
||||
// ErrorCodeSizeInvalid is returned when uploading a blob if the provided
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeSizeInvalid].
|
||||
ErrorCodeSizeInvalid = errcode.ErrorCodeSizeInvalid
|
||||
|
||||
// ErrorCodeRangeInvalid is returned when uploading a blob if the provided
|
||||
// content range is invalid.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeRangeInvalid].
|
||||
ErrorCodeRangeInvalid = errcode.ErrorCodeRangeInvalid
|
||||
|
||||
// ErrorCodeNameInvalid is returned when the name in the manifest does not
|
||||
// match the provided name.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeNameInvalid].
|
||||
ErrorCodeNameInvalid = errcode.ErrorCodeNameInvalid
|
||||
|
||||
// ErrorCodeTagInvalid is returned when the tag in the manifest does not
|
||||
// match the provided tag.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeTagInvalid].
|
||||
ErrorCodeTagInvalid = errcode.ErrorCodeTagInvalid
|
||||
|
||||
// ErrorCodeNameUnknown when the repository name is not known.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeNameUnknown].
|
||||
ErrorCodeNameUnknown = errcode.ErrorCodeNameUnknown
|
||||
|
||||
// ErrorCodeManifestUnknown returned when image manifest is unknown.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeManifestUnknown].
|
||||
ErrorCodeManifestUnknown = errcode.ErrorCodeManifestUnknown
|
||||
|
||||
// ErrorCodeManifestInvalid returned when an image manifest is invalid,
|
||||
// typically during a PUT operation. This error encompasses all errors
|
||||
// encountered during manifest validation that aren't signature errors.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeManifestInvalid].
|
||||
ErrorCodeManifestInvalid = errcode.ErrorCodeManifestInvalid
|
||||
|
||||
// ErrorCodeManifestUnverified is returned when the manifest fails
|
||||
// signature verification.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeManifestUnverified].
|
||||
ErrorCodeManifestUnverified = errcode.ErrorCodeManifestUnverified
|
||||
|
||||
// ErrorCodeManifestBlobUnknown is returned when a manifest blob is
|
||||
// unknown to the registry.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeManifestBlobUnknown].
|
||||
ErrorCodeManifestBlobUnknown = errcode.ErrorCodeManifestBlobUnknown
|
||||
|
||||
// ErrorCodeBlobUnknown is returned when a blob is unknown to the
|
||||
// registry. This can happen when the manifest references a nonexistent
|
||||
// layer or the result is not found by a blob fetch.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeBlobUnknown].
|
||||
ErrorCodeBlobUnknown = errcode.ErrorCodeBlobUnknown
|
||||
|
||||
// ErrorCodeBlobUploadUnknown is returned when an upload is unknown.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeBlobUploadUnknown].
|
||||
ErrorCodeBlobUploadUnknown = errcode.ErrorCodeBlobUploadUnknown
|
||||
|
||||
// ErrorCodeBlobUploadInvalid is returned when an upload is invalid.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodeBlobUploadInvalid].
|
||||
ErrorCodeBlobUploadInvalid = errcode.ErrorCodeBlobUploadInvalid
|
||||
|
||||
// ErrorCodePaginationNumberInvalid is returned when the `n` parameter is
|
||||
// not an integer, or `n` is negative.
|
||||
//
|
||||
// Deprecated: use [errcode.ErrorCodePaginationNumberInvalid].
|
||||
ErrorCodePaginationNumberInvalid = errcode.ErrorCodePaginationNumberInvalid
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue